1 |
/* |
2 |
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
* Expert Group and released to the public domain, as explained at |
4 |
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
*/ |
6 |
|
7 |
/** |
8 |
* Interfaces and classes providing a framework for locking and waiting |
9 |
* for conditions that is distinct from built-in synchronization and |
10 |
* monitors. The framework permits much greater flexibility in the use of |
11 |
* locks and conditions, at the expense of more awkward syntax. |
12 |
* |
13 |
* <p>The {@link java.util.concurrent.locks.Lock} interface supports |
14 |
* locking disciplines that differ in semantics (reentrant, fair, etc), |
15 |
* and that can be used in non-block-structured contexts including |
16 |
* hand-over-hand and lock reordering algorithms. The main implementation |
17 |
* is {@link java.util.concurrent.locks.ReentrantLock}. |
18 |
* |
19 |
* <p>The {@link java.util.concurrent.locks.ReadWriteLock} interface |
20 |
* similarly defines locks that may be shared among readers but are |
21 |
* exclusive to writers. Only a single implementation, {@link |
22 |
* java.util.concurrent.locks.ReentrantReadWriteLock}, is provided, since |
23 |
* it covers most standard usage contexts. But programmers may create |
24 |
* their own implementations to cover nonstandard requirements. |
25 |
* |
26 |
* <p>The {@link java.util.concurrent.locks.Condition} interface |
27 |
* describes condition variables that may be associated with Locks. |
28 |
* These are similar in usage to the implicit monitors accessed using |
29 |
* {@code Object.wait}, but offer extended capabilities. |
30 |
* In particular, multiple {@code Condition} objects may be associated |
31 |
* with a single {@code Lock}. To avoid compatibility issues, the |
32 |
* names of {@code Condition} methods are different from the |
33 |
* corresponding {@code Object} versions. |
34 |
* |
35 |
* <p>The {@link java.util.concurrent.locks.AbstractQueuedSynchronizer} |
36 |
* class serves as a useful superclass for defining locks and other |
37 |
* synchronizers that rely on queuing blocked threads. The {@link |
38 |
* java.util.concurrent.locks.AbstractQueuedLongSynchronizer} class |
39 |
* provides the same functionality but extends support to 64 bits of |
40 |
* synchronization state. Both extend class {@link |
41 |
* java.util.concurrent.locks.AbstractOwnableSynchronizer}, a simple |
42 |
* class that helps record the thread currently holding exclusive |
43 |
* synchronization. The {@link java.util.concurrent.locks.LockSupport} |
44 |
* class provides lower-level blocking and unblocking support that is |
45 |
* useful for those developers implementing their own customized lock |
46 |
* classes. |
47 |
* |
48 |
* @since 1.5 |
49 |
*/ |
50 |
package java.util.concurrent.locks; |