Examples of attempt()


Examples of org.jboss.ejb.plugins.lock.NonReentrantLock.attempt()

      boolean locked = false;
      try
      {
         while (!locked)
         {
            if (methodLock.attempt(5000, miTx, nonReentrant))
            {
               locked = true;
            }
            else
            {
View Full Code Here

Examples of org.vmmagic.unboxed.Address.attempt()

        } else {
            final Address ownerAddr = ObjectReference.fromObject(this)
                .toAddress();
            final ObjectReference procRef = ObjectReference.fromObject(VmMagic
                .currentProcessor());
            while (!ownerAddr.attempt(null, procRef)) {
                // Busy wait
            }
            // Now I'm the owner
            lockCount = lockCount.add(Word.one());
        }
View Full Code Here

Examples of org.vmmagic.unboxed.Address.attempt()

        final Address lcAddr = getLCAddress();
        while (loop) {
            // Get current thread
            final VmThread current = VmMagic.currentProcessor().getCurrentThread();
            // Try to claim this monitor
            if (lcAddr.attempt(0, 1)) {
                loop = false;
                dropFromOwner();
                this.owner = current;
                addToOwner();
            } else {
View Full Code Here

Examples of org.vmmagic.unboxed.Address.attempt()

     */
    @Inline
    private final void lock() {
        //final VmProcessor proc = VmProcessor.current();
        final Address mlAddr = ObjectReference.fromObject(this).toAddress().add(4);
        while (!mlAddr.attempt(0, 1)) {
            //proc.yield(true); // Yield breaks the Uninterruptible idea, so don't use it!
        }
    }

    /**
 
View Full Code Here

Examples of org.vmmagic.unboxed.Address.attempt()

     * @see #monitorLock
     */
    @Inline
    private final boolean lockNoWait() {
        final Address mlAddr = ObjectReference.fromObject(this).toAddress().add(4);
        return mlAddr.attempt(0, 1);
    }

    /**
     * Release access to this monitor. A monitor may only be locked for a small
     * amount of time, since this method uses a spinlock.
View Full Code Here

Examples of org.vmmagic.unboxed.Address.attempt()

            Unsafe.die("Deadlock in SpinLock#lock");
        }

        // Do the spinlock
        final Address mlAddr = ObjectReference.fromObject(this).toAddress();
        while (!mlAddr.attempt(0, 1)) {
            current.yield(true);
        }
        this.owner = current;
    }
View Full Code Here

Examples of org.vmmagic.unboxed.Address.attempt()

        for (;;) {
            // attempt fast path: object is not locked.
            final Word oldlockword = statusPtr.prepareWord();

            final Word statusFlags = oldlockword.and(Word.fromIntZeroExtend(ObjectFlags.STATUS_FLAGS_MASK));
            if (statusPtr.attempt(statusFlags, statusFlags.or(tid))) {
                // fast path succeeded, the object was not locked and
                // has been locked by the current thread.
                return;
            }
View Full Code Here

Examples of org.vmmagic.unboxed.Address.attempt()

                    final Word newlockword;
                    newlockword = oldlockword.add(Word.fromIntZeroExtend(ObjectFlags.LOCK_COUNT_INC));
                    // Try to update lock, it may be inflated by some other
                    // thread, so
                    // be cautious
                    if (statusPtr.attempt(oldlockword, newlockword)) {
                        return;
                    }
                }
            } else {
                // Another thread owns the lock
View Full Code Here

Examples of org.vmmagic.unboxed.Address.attempt()

                    newlockword = oldlockword.and(Word.fromIntZeroExtend(ObjectFlags.STATUS_FLAGS_MASK));
                } else {
                    // count is non-zero, decrement count
                    newlockword = oldlockword.sub(Word.fromIntSignExtend(ObjectFlags.LOCK_COUNT_INC));
                }
                if (statusPtr.attempt(oldlockword, newlockword)) {
                    return;
                }
            } else {
                // lock not owned by us!
                String exMsg = "Lock not owned by us:";
View Full Code Here

Examples of org.vmmagic.unboxed.Address.attempt()

            }
            m.initialize(thread, lockcount);

            final Word statusFlags = oldlockword.and(Word.fromIntZeroExtend(ObjectFlags.STATUS_FLAGS_MASK));
            final Word newlockword = monAddr.or(statusFlags).or(Word.fromIntZeroExtend(ObjectFlags.LOCK_EXPANDED));
            if (statusPtr.attempt(oldlockword, newlockword)) {
                // successfully obtained inflated lock.
                return m;
            }
        }
    }
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.