private static int rb_io_fptr_finalize(Ruby runtime, OpenFile fptr) { if (fptr == null) return 0; fptr.setPath(null);; if (fptr.fd() != null) fptr.cleanup(runtime, true); fptr.write_lock = null; if (fptr.rbuf.ptr != null) { fptr.rbuf.ptr = null; } if (fptr.wbuf.ptr != null) { fptr.wbuf.ptr = null; } fptr.clearCodeConversion(); return 1; }
private static int rb_io_fptr_finalize(Ruby runtime, OpenFile fptr) { if (fptr == null) return 0; fptr.setPath(null);; if (fptr.fd() != null) fptr.cleanup(runtime, true); fptr.write_lock = null; if (fptr.rbuf.ptr != null) { fptr.rbuf.ptr = null; } if (fptr.wbuf.ptr != null) { fptr.wbuf.ptr = null; } fptr.clearCodeConversion(); return 1; }
protected IRubyObject ioClose(Ruby runtime) { if (openFile == null) return runtime.getNil(); interruptBlockingThreads(); /* FIXME: Why did we go to this trouble and not use these descriptors? ChannelDescriptor main, pipe; if (openFile.getPipeStream() != null) { pipe = openFile.getPipeStream().getDescriptor(); } else { if (openFile.getMainStream() == null) { return runtime.getNil(); } pipe = null; } main = openFile.getMainStream().getDescriptor(); */ // cleanup, raising errors if any openFile.cleanup(runtime, true); // TODO: notify threads waiting on descriptors/IO? probably not... // If this is not a popen3/popen4 stream and it has a process, attempt to shut down that process if (!popenSpecial && openFile.getProcess() != null) { obliterateProcess(openFile.getProcess()); IRubyObject processResult = RubyProcess.RubyStatus.newProcessStatus(runtime, openFile.getProcess().exitValue(), openFile.getPid()); runtime.getCurrentContext().setLastExitStatus(processResult); } return runtime.getNil(); }
protected IRubyObject ioClose(Ruby runtime) { if (openFile == null) return runtime.getNil(); interruptBlockingThreads(); /* FIXME: Why did we go to this trouble and not use these descriptors? ChannelDescriptor main, pipe; if (openFile.getPipeStream() != null) { pipe = openFile.getPipeStream().getDescriptor(); } else { if (openFile.getMainStream() == null) { return runtime.getNil(); } pipe = null; } main = openFile.getMainStream().getDescriptor(); */ // cleanup, raising errors if any openFile.cleanup(runtime, true); // TODO: notify threads waiting on descriptors/IO? probably not... // If this is not a popen3/popen4 stream and it has a process, attempt to shut down that process if (!popenSpecial && openFile.getProcess() != null) { obliterateProcess(openFile.getProcess()); IRubyObject processResult = RubyProcess.RubyStatus.newProcessStatus(runtime, openFile.getProcess().exitValue(), openFile.getPid()); runtime.getCurrentContext().setLastExitStatus(processResult); } return runtime.getNil(); }
fptr.cleanup(runtime, false);
fptr.cleanup(runtime, false);
openFile.cleanup(runtime, false);
openFile.cleanup(runtime, false);