142 |
|
private volatile E item; |
143 |
|
private volatile Node<E> next; |
144 |
|
|
145 |
+ |
/** |
146 |
+ |
* Constructs a new node. Uses relaxed write because item can |
147 |
+ |
* only be seen after publication via casNext. |
148 |
+ |
*/ |
149 |
|
Node(E item) { |
150 |
< |
// Piggyback on imminent casNext() |
147 |
< |
lazySetItem(item); |
150 |
> |
UNSAFE.putObject(this, itemOffset, item); |
151 |
|
} |
152 |
|
|
153 |
|
E getItem() { |
162 |
|
item = val; |
163 |
|
} |
164 |
|
|
162 |
– |
void lazySetItem(E val) { |
163 |
– |
UNSAFE.putOrderedObject(this, itemOffset, val); |
164 |
– |
} |
165 |
– |
|
165 |
|
void lazySetNext(Node<E> val) { |
166 |
|
UNSAFE.putOrderedObject(this, nextOffset, val); |
167 |
|
} |