Package co.paralleluniverse.strands

Examples of co.paralleluniverse.strands.Condition.register()


                return null;
            action.setItem(dv.getValue());
            action.won();
            return null;
        }
        sync.register();
        return action;
    }

    @Override
    public boolean tryNow(Object token) {
View Full Code Here


            public void run() throws SuspendExecution, InterruptedException {
                foo();
            }

            private void foo() throws InterruptedException, SuspendExecution {
                Object token = cond.register();
                try {
                    for (int i = 0; !flag.get(); i++)
                        cond.await(i);
                } finally {
                    cond.unregister(token);
View Full Code Here

            public void run() throws SuspendExecution, InterruptedException {
                foo();
            }

            private void foo() throws InterruptedException, SuspendExecution {
                Object token = cond.register();
                try {
                    for (int i = 0; !flag.get(); i++)
                        cond.await(i);
                } finally {
                    cond.unregister(token);
View Full Code Here

                return null;
            action.setItem(dv.getValue());
            action.won();
            return null;
        }
        sync.register();
        return action;
    }

    @Override
    public boolean tryNow(Object token) {
View Full Code Here

    }
   
    void attemptReceive() throws EOFException, SuspendExecution, InterruptedException {
        checkClosed();
        final Condition sync = channel.sync;
        Object token = sync.register();
        try {
            for (int i = 0; !consumer.hasNext(); i++) {
                if (channel.isSendClosed()) {
                    setReceiveClosed();
                    checkClosed();
View Full Code Here

    void attemptReceive(long timeout, TimeUnit unit) throws SuspendExecution, InterruptedException, TimeoutException, EOFException {
        checkClosed();
        final Condition sync = channel.sync;
        long left = unit.toNanos(timeout);
        final long deadline = System.nanoTime() + left;
        Object token = sync.register();
        try {
            for (int i = 0; !consumer.hasNext(); i++) {
                if (channel.isSendClosed()) {
                    setReceiveClosed();
                    checkClosed();
View Full Code Here

    void attemptReceive() throws EOFException, SuspendExecution, InterruptedException {
        if (isClosed())
            throw new EOFException();
        final Condition sync = channel.sync;
        Object token = sync.register();
        try {
            for (int i = 0; !consumer.hasNext(); i++) {
                if (channel.isSendClosed()) {
                    setReceiveClosed();
                    throw new EOFException();
View Full Code Here

        if (isClosed())
            throw new EOFException();
        final Condition sync = channel.sync;
        long left = unit.toNanos(timeout);
        final long deadline = System.nanoTime() + left;
        Object token = sync.register();
        try {
            for (int i = 0; !consumer.hasNext(); i++) {
                if (channel.isSendClosed()) {
                    setReceiveClosed();
                    throw new EOFException();
View Full Code Here

    void attemptReceive() throws SuspendExecution, InterruptedException {
        if (isClosed())
            throw new EOFException();
        final Condition sync = channel.sync;
        sync.register();
        try {
            for (int i = 0; !consumer.hasNext(); i++) {
                if (channel.isSendClosed()) {
                    setReceiveClosed();
                    throw new EOFException();
View Full Code Here

        if (isClosed())
            throw new EOFException();
        final Condition sync = channel.sync;
        final long start = System.nanoTime();
        long left = unit.toNanos(timeout);
        sync.register();
        try {
            for (int i = 0; !consumer.hasNext(); i++) {
                if (channel.isSendClosed()) {
                    setReceiveClosed();
                    throw new EOFException();
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.