Package org.jruby.util.io

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


        Ruby runtime = context.runtime;
        OpenFile fptr;

        fptr = getOpenFileChecked();

        boolean locked = fptr.lock();
        try {
            fptr.checkCharReadable(context);

            if (fptr.READ_CHAR_PENDING()) return runtime.getFalse();
            if (fptr.READ_DATA_PENDING()) return runtime.getFalse();
View Full Code Here


        Ruby runtime = context.runtime;
        OpenFile fptr;

        fptr = getOpenFileChecked();

        fptr.lock();
        try {
            if (fptr.isStdio()) return runtime.getTrue();
            if (runtime.getPosix().isNative() && runtime.getPosix().libc().isatty(fptr.getFileno()) != 0)
                return runtime.getTrue();
        } finally {
View Full Code Here

        orig = io.getOpenFileChecked();
        fptr = dest.MakeOpenFile();

        // orig is the visible one here but we lock both anyway
        boolean locked1 = orig.lock();
        boolean locked2 = fptr.lock();
        try {
            io.flush(context);

            /* copy rb_io_t structure */
            fptr.setMode(orig.getMode() & ~OpenFile.PREP);
View Full Code Here

        write_io = GetWriteIO();
        if (this != write_io) {
            write_fptr = write_io.openFile;

            boolean locked = write_fptr.lock();
            try {
                if (write_fptr != null && write_fptr.fd() != null) {
                    write_fptr.cleanup(runtime, true);
                }
            } finally {
View Full Code Here

        OpenFile fptr;
        RubyIO write_io;

        write_io = GetWriteIO();
        fptr = write_io.getOpenFileChecked();
        boolean locked = fptr.lock();
        try {
            if (fptr.socketChannel() != null) {
                try {
                    fptr.socketChannel().shutdownOutput();
                } catch (IOException ioe) {
View Full Code Here


        if (this != write_io) {
            fptr = getOpenFileChecked();

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

        OpenFile fptr;
        RubyIO write_io;

        fptr = getOpenFileChecked();

        boolean locked = fptr.lock();
        try {
            if (fptr.socketChannel() != null) {
                try {
                    fptr.socketChannel().socket().shutdownInput();
                } catch (IOException ioe) {
View Full Code Here

            write_io = GetWriteIO();
            if (this != write_io) {
                OpenFile wfptr;
                wfptr = write_io.getOpenFileChecked();

                boolean locked2 = wfptr.lock();
                try {
                    wfptr.setProcess(fptr.getProcess());
                    wfptr.setPid(fptr.getPid());
                    fptr.setProcess(null);
                    fptr.setPid(-1);
View Full Code Here

//        }

        RubyIO io = GetWriteIO();
        fptr = io.getOpenFileChecked();

        boolean locked = fptr.lock();
        try {
            if ((fptr.getMode() & OpenFile.WRITABLE) != 0) {
                if (fptr.io_fflush(context) < 0)
                    throw context.runtime.newErrnoFromErrno(fptr.errno(), "");
                //            #ifdef _WIN32
View Full Code Here

    public int getByte(ThreadContext context) {
        int c;

        OpenFile fptr = getOpenFileChecked();

        boolean locked = fptr.lock();
        try {
            fptr.checkByteReadable(context);
            fptr.READ_CHECK(context);
            // TODO: tty flushing
            //        if (fptr->fd == 0 && (fptr->mode & FMODE_TTY) && RB_TYPE_P(rb_stdout, T_FILE)) {
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.