Inheritance diagram for AbstractLock:
Public Member Functions | |
Node | v_head () |
void | v_head (Node val) |
Node | v_tail () |
void | v_tail (Node val) |
bool | isHeldExclusively () |
void | acquire (int arg) |
bool | tryAcquireNanos (int arg, long nanosTimeout) |
bool | release (int arg) |
void | acquireShared (int arg) |
bool | tryAcquireSharedNanos (int arg, long nanosTimeout) |
bool | releaseShared (int arg) |
bool | hasQueuedThreads () |
bool | hasContended () |
Thread | getFirstQueuedThread () |
Protected Member Functions | |
this () | |
final int | state () |
final void | state (int newState) |
bool | tryAcquire (int arg) |
bool | tryRelease (int arg) |
int | tryAcquireShared (int arg) |
bool | tryReleaseShared (int arg) |
Protected Attributes | |
int | state_ |
Private Member Functions | |
Node | enq (Node node) |
Node | addWaiter (Node mode) |
void | setHead (Node node) |
void | unparkSuccessor (Node node) |
void | setHeadAndPropagate (Node node, int propagate) |
void | cancelAcquire (Node node) |
void | acquireQueued (Node node, int arg) |
bool | doAcquireNanos (int arg, long nanosTimeout) |
void | doAcquireShared (int arg) |
bool | doAcquireSharedNanos (int arg, long nanosTimeout) |
Thread | fullGetFirstQueuedThread () |
bool | isQueued (Thread thread) |
int | getQueueLength () |
Thread[] | getQueuedThreads () |
Thread[] | getExclusiveQueuedThreads () |
Thread[] | getSharedQueuedThreads () |
char[] | toString () |
bool | isOnSyncQueue (Node node) |
bool | findNodeFromTail (Node node) |
bool | transferForNotify (Node node) |
bool | transferAfterCancelledWait (Node node) |
int | fullyRelease (Node node) |
bool | owns (ConditionObject condition) |
bool | hasWaiters (ConditionObject condition) |
int | getWaitQueueLength (ConditionObject condition) |
Thread[] | getWaitingThreads (ConditionObject condition) |
Static Private Member Functions | |
static bool | shouldParkAfterFailedAcquire (Node pred, Node node) |
Private Attributes | |
Node | head |
Node | tail |
Classes | |
class | ConditionObject |
class | Node |
This class is designed to be a useful basis for most kinds of synchronizers that rely on a single atomic int
value to represent state. Subclasses must define the protected methods that change this state, and which define what that state means in terms of this object being acquired or released. Given these, the other methods in this class carry out all queuing and blocking mechanics. Subclasses can maintain other state fields, but only the atomically updated int
value manipulated using the getter and setter for the state property and compareAndSet32 is tracked with respect to synchronization.
Subclasses should be defined as non-public internal helper classes that are used to implement the synchronization properties of their enclosing class. Class AbstractLock
does not implement any synchronization interface. Instead it defines methods such as acquire that can be invoked as appropriate by concrete locks and related synchronizers to implement their public methods.
This class supports either or both a default exclusive mode and a shared mode. When acquired in exclusive mode, attempted acquires by other threads cannot succeed. Shared mode acquires by multiple threads may (but need not) succeed. This class does not "understand" these differences except in the mechanical sense that when a shared mode acquire succeeds, the next waiting thread (if one exists) must also determine whether it can acquire as well. Threads waiting in the different modes share the same FIFO queue. Usually, implementation subclasses support only one of these modes, but both can come into play for example in a ReadWriteLock. Subclasses that support only exclusive or only shared modes need not define the methods supporting the unused mode.
This class defines a nested ConditionObject class that can be used as a Condition implementation by subclasses supporting exclusive mode for which method isHeldExclusively reports whether synchronization is exclusively held with respect to the current thread, method release invoked with the current state value fully releases this object, and acquire, given this saved state value, eventually restores this object to its previous acquired state. No AbstractLock
method otherwise creates such a condition, so if this constraint cannot be met, do not use it. The behavior of ConditionObject depends of course on the semantics of its synchronizer implementation.
This class provides inspection, instrumentation, and monitoring methods for the internal queue, as well as similar methods for condition objects. These can be exported as desired into classes using an AbstractLock
for their synchronization mechanics.
To use this class as the basis of a synchronizer, redefine the following methods, as applicable, by inspecting and/or modifying the synchronization state using the state getter and setter and/or compareAndSet32.
Each of these methods by default throws UnsupportedOperationException. Implementations of these methods must be internally thread-safe, and should in general be short and not block. Defining these methods is the only supported means of using this class. All other methods are declared final
because they cannot be independently varied.
Even though this class is based on an internal FIFO queue, it does not automatically enforce FIFO acquisition policies. The core of exclusive synchronization takes the form:
Acquire: while (!tryAcquire(arg)) { enqueue thread if it is not already queued; possibly block current thread; }
Release: if (tryRelease(arg)) unblock the first queued thread;
(Shared mode is similar but may involve cascading signals.)
Because checks in acquire are invoked before enqueuing, a newly acquiring thread may barge ahead of others that are blocked and queued. However, you can, if desired, define tryAcquire
and/or tryAcquireShared
to disable barging by internally invoking one or more of the inspection methods. In particular, a strict FIFO lock can define tryAcquire
to immediately return false
if getFirstQueuedThread does not return the current thread. A normally preferable non-strict fair version can immediately return false
only if hasQueuedThreads returns true
and getFirstQueuedThread
is not the current thread; or equivalently, that getFirstQueuedThread
is both non-null and not the current thread. Further variations are possible.
Throughput and scalability are generally highest for the default barging (also known as greedy, renouncement, and convoy-avoidance) strategy. While this is not guaranteed to be fair or starvation-free, earlier queued threads are allowed to recontend before later queued threads, and each recontention has an unbiased chance to succeed against incoming threads. Also, while acquires do not "spin" in the usual sense, they may perform multiple invocations of tryAcquire
interspersed with other computations before blocking. This gives most of the benefits of spins when exclusive synchronization is only briefly held, without most of the liabilities when it isn't. If so desired, you can augment this by preceding calls to acquire methods with "fast-path" checks, possibly prechecking hasContended and/or hasQueuedThreads to only do so if the synchronizer is likely not to be contended.
Here is a non-reentrant mutual exclusion lock class that uses the value zero to represent the unlocked state, and one to represent the locked state. It also supports conditions and exposes one of the instrumentation methods:
class Mutex : Lock { // Our internal helper class private class Sync : AbstractLock { // Report whether in locked state bool isHeldExclusively() { return state == 1; } // Acquire the lock if state is zero bool tryAcquire(int acquires) { assert ( acquires == 1 ); // Otherwise unused return Atomic.compareAndSet32(&state, 0, 1); } // Release the lock by setting state to zero protected bool tryRelease(int releases) { assert ( releases == 1 ); // Otherwise unused state = 0; return true; } // Provide a Condition Condition newCondition() { return new ConditionObject(); } } // The sync object does all the hard work. We just forward to it. private Sync sync = new Sync(); void lock() { sync.acquire(1); } bool tryLock() { return sync.tryAcquire(1); } void unlock() { sync.release(1); } Condition newCondition() { return sync.newCondition(); } bool isLocked() { return sync.isHeldExclusively(); } bool hasQueuedThreads() { return sync.hasQueuedThreads(); } bool tryLock(long timeout, TimeUnit unit) { return sync.tryAcquireNanos(1, toNanos(timeout,unit)); } }
Here is a latch class that is like a CountDownLatch except that it only requires a single notify
to fire. Because a latch is non-exclusive, it uses the shared
acquire and release methods.
class BoolLatch { private class Sync : AbstractLock { bool isSignalled() { return state != 0; } protected int tryAcquireShared(int ignore) { return isSignalled()? 1 : -1; } protected bool tryReleaseShared(int ignore) { state = 1; return true; } } private final Sync sync = new Sync(); bool isSignalled() { return sync.isSignalled(); } void notify() { sync.releaseShared(1); } void wait() { sync.acquireShared(1); } }
Definition at line 232 of file LockImpl.d.
|
Creates a new Definition at line 238 of file LockImpl.d. |
|
Definition at line 448 of file LockImpl.d. References head. Referenced by acquireQueued(), doAcquireNanos(), doAcquireShared(), doAcquireSharedNanos(), and hasContended(). |
|
Definition at line 449 of file LockImpl.d. References head. |
|
Definition at line 456 of file LockImpl.d. References tail. Referenced by addWaiter(), enq(), findNodeFromTail(), getExclusiveQueuedThreads(), getQueuedThreads(), getQueueLength(), getSharedQueuedThreads(), and isQueued(). |
|
Definition at line 457 of file LockImpl.d. References tail. |
|
Returns the current value of synchronization state. This operation has memory semantics of a
Definition at line 469 of file LockImpl.d. References state_. Referenced by fullyRelease(), and toString(). |
|
Sets the value of synchronization state. This operation has memory semantics of a
Definition at line 478 of file LockImpl.d. References state_. |
|
Insert node into queue, initializing if necessary. See picture above.
Definition at line 489 of file LockImpl.d. References head, AbstractLock::Node::next, Node, AbstractLock::Node::prev, tail, AbstractLock::Node::v_next(), AbstractLock::Node::v_prev(), and v_tail(). Referenced by addWaiter(), transferAfterCancelledWait(), and transferForNotify(). |
|
Create and enq node for given thread and mode
Definition at line 521 of file LockImpl.d. References enq(), Node, tail, AbstractLock::Node::v_next(), AbstractLock::Node::v_prev(), and v_tail(). Referenced by acquire(), doAcquireNanos(), doAcquireShared(), and doAcquireSharedNanos(). |
|
Set head of queue to be node, thus dequeuing. Called only by acquire methods. Also nulls out unused fields for sake of GC and to suppress unnecessary signals and traversals.
Definition at line 542 of file LockImpl.d. References head, AbstractLock::Node::prev, and AbstractLock::Node::thread. Referenced by acquireQueued(), doAcquireNanos(), and setHeadAndPropagate(). |
|
Wake up node's successor, if one exists.
Definition at line 554 of file LockImpl.d. References AbstractLock::Node::next, AbstractLock::Node::prev, AbstractLock::Node::SIGNAL, tail, AbstractLock::Node::thread, thread, and AbstractLock::Node::waitStatus. Referenced by cancelAcquire(), release(), releaseShared(), and setHeadAndPropagate(). |
|
Set head of queue, and check if successor may be waiting in shared mode, if so propagating if propagate > 0.
Definition at line 593 of file LockImpl.d. References AbstractLock::Node::isShared(), setHead(), unparkSuccessor(), AbstractLock::Node::v_next(), and AbstractLock::Node::v_waitStatus(). Referenced by doAcquireShared(), and doAcquireSharedNanos(). |
|
Cancel an ongoing attempt to acquire.
Definition at line 612 of file LockImpl.d. References AbstractLock::Node::CANCELLED, AbstractLock::Node::thread, unparkSuccessor(), and AbstractLock::Node::waitStatus. Referenced by acquireQueued(), doAcquireNanos(), doAcquireShared(), and doAcquireSharedNanos(). |
|
Checks and updates status for a node that failed to acquire. Returns true if thread should block. This is the main signal control in all acquire loops. Requires that pred == node.prev
Definition at line 631 of file LockImpl.d. References AbstractLock::Node::prev, AbstractLock::Node::SIGNAL, AbstractLock::Node::v_prev(), AbstractLock::Node::v_waitStatus(), and AbstractLock::Node::waitStatus. Referenced by acquireQueued(), doAcquireNanos(), doAcquireShared(), and doAcquireSharedNanos(). |
|
Acquire in exclusive uninterruptible mode for thread already in queue. Used by condition wait methods as well as acquire.
Definition at line 671 of file LockImpl.d. References assert(), cancelAcquire(), Exception, AbstractLock::Node::predecessor(), setHead(), shouldParkAfterFailedAcquire(), tryAcquire(), v_head(), AbstractLock::Node::v_next(), and version. Referenced by acquire(), AbstractLock::ConditionObject::wait(), and AbstractLock::ConditionObject::waitNanos(). |
|
Acquire in exclusive timed mode
Definition at line 699 of file LockImpl.d. References addWaiter(), assert(), cancelAcquire(), Exception, AbstractLock::Node::predecessor(), setHead(), shouldParkAfterFailedAcquire(), sleepNanos(), tryAcquire(), v_head(), and AbstractLock::Node::v_next(). Referenced by tryAcquireNanos(). |
|
Acquire in shared uninterruptible mode
Definition at line 732 of file LockImpl.d. References addWaiter(), assert(), cancelAcquire(), Exception, AbstractLock::Node::predecessor(), setHeadAndPropagate(), shouldParkAfterFailedAcquire(), tryAcquireShared(), v_head(), AbstractLock::Node::v_next(), and version. Referenced by acquireShared(). |
|
Acquire in shared timed mode
Definition at line 764 of file LockImpl.d. References addWaiter(), assert(), cancelAcquire(), Exception, AbstractLock::Node::predecessor(), setHeadAndPropagate(), shouldParkAfterFailedAcquire(), sleepNanos(), tryAcquireShared(), v_head(), and AbstractLock::Node::v_next(). Referenced by tryAcquireSharedNanos(). |
|
Attempts to acquire in exclusive mode. This method should query if the state of the object permits it to be acquired in the exclusive mode, and if so to acquire it. This method is always invoked by the thread performing acquire. If this method reports failure, the acquire method may queue the thread, if it is not already queued, until it is signalled by a release from some other thread. This can be used to implement method tryLock(). The default implementation throws UnsupportedOperationException
Reimplemented in ReentrantReadWriteLock::NonfairSync, ReentrantReadWriteLock::FairSync, ReentrantLock::NonfairSync, and ReentrantLock::FairSync. Definition at line 819 of file LockImpl.d. Referenced by acquire(), acquireQueued(), doAcquireNanos(), and tryAcquireNanos(). |
|
Attempts to set the state to reflect a release in exclusive mode. This method is always invoked by the thread performing release. The default implementation throws UnsupportedOperationException
Reimplemented in ReentrantReadWriteLock::Sync, and ReentrantLock::Sync. Definition at line 840 of file LockImpl.d. Referenced by release(). |
|
Attempts to acquire in shared mode. This method should query if the state of the object permits it to be acquired in the shared mode, and if so to acquire it. This method is always invoked by the thread performing acquire. If this method reports failure, the acquire method may queue the thread, if it is not already queued, until it is signalled by a release from some other thread. The default implementation throws UnsupportedOperationException
Reimplemented in CountDownLatch::Sync, ReentrantReadWriteLock::NonfairSync, ReentrantReadWriteLock::FairSync, Semaphore::NonfairSync, and Semaphore::FairSync. Definition at line 870 of file LockImpl.d. Referenced by acquireShared(), doAcquireShared(), doAcquireSharedNanos(), and tryAcquireSharedNanos(). |
|
Attempts to set the state to reflect a release in shared mode. This method is always invoked by the thread performing release. The default implementation throws UnsupportedOperationException.
Reimplemented in CountDownLatch::Sync, ReentrantReadWriteLock::Sync, and Semaphore::Sync. Definition at line 890 of file LockImpl.d. Referenced by releaseShared(). |
|
Returns true if synchronization is held exclusively with respect to the current (calling) thread. This method is invoked upon each call to a non-waiting ConditionObject method. (Waiting methods instead invoke release.) The default implementation throws UnsupportedOperationException. This method is invoked internally only within ConditionObject methods, so need not be defined if conditions are not used.
Reimplemented in ReentrantReadWriteLock::Sync, and ReentrantLock::Sync. Definition at line 908 of file LockImpl.d. Referenced by AbstractLock::ConditionObject::getWaitingThreads(), AbstractLock::ConditionObject::getWaitQueueLength(), AbstractLock::ConditionObject::hasWaiters(), AbstractLock::ConditionObject::notify(), and AbstractLock::ConditionObject::notifyAll(). |
|
Acquires in exclusive mode. Implemented by invoking at least once tryAcquire, returning on success. Otherwise the thread is queued, possibly repeatedly blocking and unblocking, invoking tryAcquire until success. This method can be used to implement method Lock.lock
Definition at line 924 of file LockImpl.d. References acquireQueued(), addWaiter(), and tryAcquire(). Referenced by ReentrantLock::FairSync::lock(), ReentrantLock::NonfairSync::lock(), ReentrantReadWriteLock::FairSync::wlock(), and ReentrantReadWriteLock::NonfairSync::wlock(). |
|
Attempts to acquire in exclusive mode and failing if the given timeout elapses. Implemented by first checking interrupt status, then invoking at least once tryAcquire, returning on success. Otherwise, the thread is queued, possibly repeatedly blocking and unblocking, invoking tryAcquire until success or the timeout elapses. This method can be used to implement method Lock.tryLock(long, TimeUnit).
Definition at line 944 of file LockImpl.d. References doAcquireNanos(), and tryAcquire(). Referenced by ReentrantLock::tryLock(), and ReentrantReadWriteLock::WriteLock::tryLock(). |
|
Releases in exclusive mode. Implemented by unblocking one or more threads if tryRelease returns true. This method can be used to implement method Lock.unlock
Definition at line 959 of file LockImpl.d. References head, tryRelease(), unparkSuccessor(), and AbstractLock::Node::waitStatus. Referenced by fullyRelease(), ReentrantLock::unlock(), and ReentrantReadWriteLock::WriteLock::unlock(). |
|
Acquires in shared mode. Implemented by first invoking at least once tryAcquireShared, returning on success. Otherwise the thread is queued, possibly repeatedly blocking and unblocking, invoking tryAcquireShared until success.
Definition at line 981 of file LockImpl.d. References doAcquireShared(), and tryAcquireShared(). Referenced by Semaphore::acquire(), ReentrantReadWriteLock::ReadLock::lock(), and CountDownLatch::wait(). |
|
Attempts to acquire in shared mode and failing if the given timeout elapses. Implemented by invoking at least once tryAcquireShared, returning on success. Otherwise, the thread is queued, possibly repeatedly blocking and unblocking, invoking tryAcquireShared until success or the timeout elapses.
Definition at line 999 of file LockImpl.d. References doAcquireSharedNanos(), and tryAcquireShared(). Referenced by Semaphore::tryAcquire(), ReentrantReadWriteLock::ReadLock::tryLock(), and CountDownLatch::wait(). |
|
Releases in shared mode. Implemented by unblocking one or more threads if tryReleaseShared returns true.
Definition at line 1012 of file LockImpl.d. References head, tryReleaseShared(), unparkSuccessor(), and AbstractLock::Node::waitStatus. Referenced by CountDownLatch::countDown(), Semaphore::release(), and ReentrantReadWriteLock::ReadLock::unlock(). |
|
Queries whether any threads are waiting to acquire. Note that because cancellations due to interrupts and timeouts may occur at any time, a In this implementation, this operation returns in constant time.
Definition at line 1038 of file LockImpl.d. Referenced by Semaphore::hasQueuedThreads(), ReentrantLock::hasQueuedThreads(), ReentrantReadWriteLock::hasQueuedThreads(), and toString(). |
|
Queries whether any threads have ever contended to acquire this synchronizer; that is if an acquire method has ever blocked. In this implementation, this operation returns in constant time.
Definition at line 1051 of file LockImpl.d. References v_head(). |
|
Returns the first (longest-waiting) thread in the queue, or In this implementation, this operation normally returns in constant time, but may iterate upon contention if other threads are concurrently modifying the queue.
Definition at line 1066 of file LockImpl.d. References fullGetFirstQueuedThread(), head, and tail. Referenced by ReentrantLock::FairSync::tryAcquire(), ReentrantReadWriteLock::FairSync::tryAcquire(), Semaphore::FairSync::tryAcquireShared(), and ReentrantReadWriteLock::FairSync::tryAcquireShared(). |
|
Version of getFirstQueuedThread called when fastpath fails Definition at line 1074 of file LockImpl.d. References head, AbstractLock::Node::next, AbstractLock::Node::prev, tail, and AbstractLock::Node::thread. Referenced by getFirstQueuedThread(). |
|
Returns true if the given thread is currently queued. This implementation traverses the queue to determine presence of the given thread.
Definition at line 1129 of file LockImpl.d. References AbstractLock::Node::prev, thread, and v_tail(). |
|
Returns an estimate of the number of threads waiting to acquire. The value is only an estimate because the number of threads may change dynamically while this method traverses internal data structures. This method is designed for use in monitoring system state, not for synchronization control.
Definition at line 1153 of file LockImpl.d. References AbstractLock::Node::prev, and v_tail(). |
|
Returns a collection containing threads that may be waiting to acquire. Because the actual set of threads may change dynamically while constructing this result, the returned collection is only a best-effort estimate. The elements of the returned collection are in no particular order. This method is designed to facilitate construction of subclasses that provide more extensive monitoring facilities.
Definition at line 1175 of file LockImpl.d. References AbstractLock::Node::prev, AbstractLock::Node::thread, and v_tail(). |
|
Returns a collection containing threads that may be waiting to acquire in exclusive mode. This has the same properties as getQueuedThreads except that it only returns those threads waiting due to an exclusive acquire.
Definition at line 1195 of file LockImpl.d. References AbstractLock::Node::prev, AbstractLock::Node::thread, and v_tail(). |
|
Returns a collection containing threads that may be waiting to acquire in shared mode. This has the same properties as getQueuedThreads except that it only returns those threads waiting due to a shared acquire.
Definition at line 1217 of file LockImpl.d. References AbstractLock::Node::prev, AbstractLock::Node::thread, and v_tail(). |
|
Returns a string identifying this synchronizer, as well as its state. The state, in brackets, includes the String "State =" followed by the current value of state(), and either "nonempty" or "empty" depending on whether the queue is empty.
Definition at line 1241 of file LockImpl.d. References hasQueuedThreads(), and state(). |
|
Returns true if a node, always one that was initially placed on a condition queue, is now waiting to reacquire on sync queue.
Definition at line 1258 of file LockImpl.d. References AbstractLock::Node::CONDITION, findNodeFromTail(), AbstractLock::Node::next, AbstractLock::Node::prev, and AbstractLock::Node::waitStatus. Referenced by transferAfterCancelledWait(), AbstractLock::ConditionObject::wait(), and AbstractLock::ConditionObject::waitNanos(). |
|
Returns true if node is on sync queue by searching backwards from tail. Called only when needed by isOnSyncQueue.
Definition at line 1281 of file LockImpl.d. References AbstractLock::Node::v_prev(), and v_tail(). Referenced by isOnSyncQueue(). |
|
Transfers a node from a condition queue onto sync queue. Returns true if successful.
Definition at line 1306 of file LockImpl.d. References AbstractLock::Node::CONDITION, enq(), AbstractLock::Node::SIGNAL, AbstractLock::Node::v_thread(), AbstractLock::Node::v_waitStatus(), and AbstractLock::Node::waitStatus. Referenced by AbstractLock::ConditionObject::doNotify(), and AbstractLock::ConditionObject::doNotifyAll(). |
|
Transfers node, if necessary, to sync queue after a cancelled wait. Returns true if thread was cancelled before being signalled.
Definition at line 1336 of file LockImpl.d. References AbstractLock::Node::CONDITION, enq(), isOnSyncQueue(), and AbstractLock::Node::waitStatus. Referenced by AbstractLock::ConditionObject::wait(), and AbstractLock::ConditionObject::waitNanos(). |
|
Invoke release with current state value; return saved state. Cancel node and throw exception on failure.
Definition at line 1358 of file LockImpl.d. References AbstractLock::Node::CANCELLED, Exception, release(), state(), and AbstractLock::Node::v_waitStatus(). Referenced by AbstractLock::ConditionObject::wait(), and AbstractLock::ConditionObject::waitNanos(). |
|
Queries whether the given ConditionObject uses this synchronizer as its lock.
Definition at line 1380 of file LockImpl.d. References AbstractLock::ConditionObject::isOwnedBy(). Referenced by getWaitingThreads(), getWaitQueueLength(), and hasWaiters(). |
|
Queries whether any threads are waiting on the given condition associated with this synchronizer. Note that because timeouts and interrupts may occur at any time, a
Definition at line 1396 of file LockImpl.d. References AbstractLock::ConditionObject::hasWaiters(), and owns(). |
|
Returns an estimate of the number of threads waiting on the given condition associated with this synchronizer. Note that because timeouts may occur at any time, the estimate serves only as an upper bound on the actual number of waiters. This method is designed for use in monitoring of the system state, not for synchronization control.
Definition at line 1412 of file LockImpl.d. References AbstractLock::ConditionObject::getWaitQueueLength(), and owns(). |
|
Returns a collection containing those threads that may be waiting on the given condition associated with this synchronizer. Because the actual set of threads may change dynamically while constructing this result, the returned collection is only a best-effort estimate. The elements of the returned collection are in no particular order.
Definition at line 1428 of file LockImpl.d. References AbstractLock::ConditionObject::getWaitingThreads(), and owns(). |
|
Head of the wait queue, lazily initialized. Except for initialization, it is modified only via method setHead. Note: If head exists, its waitStatus is guaranteed not to be CANCELLED. Definition at line 447 of file LockImpl.d. Referenced by enq(), fullGetFirstQueuedThread(), getFirstQueuedThread(), hasQueuedThreads(), release(), releaseShared(), setHead(), and v_head(). |
|
Tail of the wait queue, lazily initialized. Modified only via method enq to add new wait node. Definition at line 455 of file LockImpl.d. Referenced by addWaiter(), enq(), fullGetFirstQueuedThread(), getFirstQueuedThread(), hasQueuedThreads(), unparkSuccessor(), and v_tail(). |
|
The synchronization state. Definition at line 462 of file LockImpl.d. Referenced by state(). |