63 |
|
* |
64 |
|
* <p>StampedLocks are designed for use as internal utilities in the |
65 |
|
* development of thread-safe components. Their use relies on |
66 |
< |
* knowledge of the internal properties of the the data, objects, and |
66 |
> |
* knowledge of the internal properties of the data, objects, and |
67 |
|
* methods they are protecting. They are not reentrant, so locked |
68 |
|
* bodies should not call other unknown methods that may try to |
69 |
|
* re-acquire locks (although you may pass a stamp to other methods |
156 |
|
* } |
157 |
|
* } |
158 |
|
* } finally { |
159 |
< |
* sl.unlock(stamp); |
159 |
> |
* sl.unlock(stamp); |
160 |
|
* } |
161 |
|
* } |
162 |
|
* }}</pre> |
226 |
|
* threads. Both await methods use a similar spin strategy: If |
227 |
|
* the associated queue appears to be empty, then the thread |
228 |
|
* spin-waits up to SPINS times (where each iteration decreases |
229 |
< |
* spin count with 50% probablility) before enqueing, and then, if |
229 |
> |
* spin count with 50% probability) before enqueuing, and then, if |
230 |
|
* it is the first thread to be enqueued, spins again up to SPINS |
231 |
|
* times before blocking. If, upon wakening it fails to obtain |
232 |
|
* lock, and is still (or becomes) the first waiting thread (which |
995 |
|
else if ((time = deadline - System.nanoTime()) <= 0L) |
996 |
|
return cancelWriter(node, false); |
997 |
|
if (node.prev == p && p.status == WAITING && |
998 |
< |
(p != whead || (state & WBIT) != 0L)) // recheck |
998 |
> |
(p != whead || (state & ABITS) != 0L)) // recheck |
999 |
|
U.park(false, time); |
1000 |
|
if (interruptible && Thread.interrupted()) |
1001 |
|
return cancelWriter(node, true); |