1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| abstract static class Node { volatile Node prev; volatile Node next; Thread waiter; volatile int status;
final boolean casPrev(Node c, Node v) { return U.weakCompareAndSetReference(this, PREV, c, v); } final boolean casNext(Node c, Node v) { return U.weakCompareAndSetReference(this, NEXT, c, v); } final int getAndUnsetStatus(int v) { return U.getAndBitwiseAndInt(this, STATUS, ~v); } final void setPrevRelaxed(Node p) { U.putReference(this, PREV, p); } final void setStatusRelaxed(int s) { U.putInt(this, STATUS, s); } final void clearStatus() { U.putIntOpaque(this, STATUS, 0); }
private static final long STATUS = U.objectFieldOffset(Node.class, "status"); private static final long NEXT = U.objectFieldOffset(Node.class, "next"); private static final long PREV = U.objectFieldOffset(Node.class, "prev"); }
|