Package org.jruby.util.io

Examples of org.jruby.util.io.OpenFile.unlock()


            //        #endif
            if (fptr.fillbuf(context) < 0) {
                return runtime.getTrue();
            }
        } finally {
            if (locked) fptr.unlock();
        }

        return runtime.getFalse();
    }
View Full Code Here


        try {
            if (fptr.isStdio()) return runtime.getTrue();
            if (runtime.getPosix().isNative() && runtime.getPosix().libc().isatty(fptr.getFileno()) != 0)
                return runtime.getTrue();
        } finally {
            fptr.unlock();
        }

        return runtime.getFalse();
    }
View Full Code Here

            fptr.setFD(fd);
            pos = orig.tell(context);
            if (0 <= pos)
                fptr.seek(context, pos, PosixShim.SEEK_SET);
        } finally {
            if (locked2) fptr.unlock();
            if (locked1) orig.unlock();
        }

        if (fptr.isBinmode()) {
            dest.setBinmode();
View Full Code Here

            try {
                if (write_fptr != null && write_fptr.fd() != null) {
                    write_fptr.cleanup(runtime, true);
                }
            } finally {
                if (locked) write_fptr.unlock();
            }
        }

        fptr = openFile;
View Full Code Here

            if (fptr.isReadable()) {
                throw runtime.newIOError("closing non-duplex IO for writing");
            }
        } finally {
            if (locked) fptr.unlock();
        }


        if (this != write_io) {
            fptr = getOpenFileChecked();
View Full Code Here

            locked = fptr.lock();
            try {
                fptr.tiedIOForWriting = null;
                fptr.setMode(fptr.getMode() & ~OpenFile.DUPLEX);
            } finally {
                if (locked) fptr.unlock();
            }
        }

        write_io.rbIoClose(runtime);
        return context.nil;
View Full Code Here

                    write_io.openFile = fptr;
                    fptr.cleanup(runtime, false);
                    /* should not finalize fptr because another thread may be reading it */
                    return context.nil;
                } finally {
                    if (locked2) wfptr.unlock();
                }
            }

            if (fptr.isWritable()) {
                throw runtime.newIOError("closing non-duplex IO for reading");
View Full Code Here

            }
            if ((fptr.getMode() & OpenFile.READABLE) != 0) {
                fptr.unread(context);
            }
        } finally {
            if (locked) fptr.unlock();
        }

        return io;
    }
View Full Code Here

            }
            fptr.rbuf.off++;
            fptr.rbuf.len--;
            return fptr.rbuf.ptr[fptr.rbuf.off - 1] & 0xFF;
        } finally {
            if (locked) fptr.unlock();
        }
    }

    // rb_io_readbyte
    @JRubyMethod
View Full Code Here

            enc = fptr.inputEncoding(runtime);
            fptr.READ_CHECK(context);
            return fptr.getc(context, enc);
        } finally {
            if (locked) fptr.unlock();
        }
    }

    // rb_io_ungetbyte
    @JRubyMethod
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.