示例#1
0
文件: io.cpp 项目: dziulius/rubinius
  void rb_io_check_closed(rb_io_t* iot) {
    VALUE io_handle = iot->handle;
    NativeMethodEnvironment* env = NativeMethodEnvironment::get();
    IO* io = c_as<IO>(env->get_object(io_handle));

    if(io->descriptor()->to_native() == -1) {
      rb_raise(rb_eIOError, "closed stream");
    }
  }
示例#2
0
文件: io.cpp 项目: dziulius/rubinius
  int rb_io_fd(VALUE io_handle) {
    NativeMethodEnvironment* env = NativeMethodEnvironment::get();

    IO* io = c_as<IO>(env->get_object(io_handle));
    return io->descriptor()->to_native();
  }