301 |
|
* of less-contended queues. During spins threads check their |
302 |
|
* interrupt status and generate a thread-local random number |
303 |
|
* to decide to occasionally perform a Thread.yield. While |
304 |
< |
* yield has underdefined specs, we assume that might it help, |
305 |
< |
* and will not hurt in limiting impact of spinning on busy |
304 |
> |
* yield has underdefined specs, we assume that it might help, |
305 |
> |
* and will not hurt, in limiting impact of spinning on busy |
306 |
|
* systems. We also use smaller (1/2) spins for nodes that are |
307 |
|
* not known to be front but whose predecessors have not |
308 |
|
* blocked -- these "chained" spins avoid artifacts of |
513 |
|
static { |
514 |
|
try { |
515 |
|
UNSAFE = getUnsafe(); |
516 |
< |
Class k = Node.class; |
516 |
> |
Class<?> k = Node.class; |
517 |
|
itemOffset = UNSAFE.objectFieldOffset |
518 |
|
(k.getDeclaredField("item")); |
519 |
|
nextOffset = UNSAFE.objectFieldOffset |
598 |
|
break; // unless slack < 2 |
599 |
|
} |
600 |
|
LockSupport.unpark(p.waiter); |
601 |
< |
return this.<E>cast(item); |
601 |
> |
return LinkedTransferQueue.<E>cast(item); |
602 |
|
} |
603 |
|
} |
604 |
|
Node n = p.next; |
676 |
|
if (item != e) { // matched |
677 |
|
// assert item != s; |
678 |
|
s.forgetContents(); // avoid garbage |
679 |
< |
return this.<E>cast(item); |
679 |
> |
return LinkedTransferQueue.<E>cast(item); |
680 |
|
} |
681 |
|
if ((w.isInterrupted() || (timed && nanos <= 0)) && |
682 |
|
s.casItem(e, s)) { // cancel |
757 |
|
Object item = p.item; |
758 |
|
if (p.isData) { |
759 |
|
if (item != null && item != p) |
760 |
< |
return this.<E>cast(item); |
760 |
> |
return LinkedTransferQueue.<E>cast(item); |
761 |
|
} |
762 |
|
else if (item == null) |
763 |
|
return null; |
1134 |
|
if (c == this) |
1135 |
|
throw new IllegalArgumentException(); |
1136 |
|
int n = 0; |
1137 |
< |
E e; |
1138 |
< |
while ( (e = poll()) != null) { |
1137 |
> |
for (E e; (e = poll()) != null;) { |
1138 |
|
c.add(e); |
1139 |
|
++n; |
1140 |
|
} |
1151 |
|
if (c == this) |
1152 |
|
throw new IllegalArgumentException(); |
1153 |
|
int n = 0; |
1154 |
< |
E e; |
1156 |
< |
while (n < maxElements && (e = poll()) != null) { |
1154 |
> |
for (E e; n < maxElements && (e = poll()) != null;) { |
1155 |
|
c.add(e); |
1156 |
|
++n; |
1157 |
|
} |
1291 |
|
throws java.io.IOException, ClassNotFoundException { |
1292 |
|
s.defaultReadObject(); |
1293 |
|
for (;;) { |
1294 |
< |
@SuppressWarnings("unchecked") E item = (E) s.readObject(); |
1294 |
> |
@SuppressWarnings("unchecked") |
1295 |
> |
E item = (E) s.readObject(); |
1296 |
|
if (item == null) |
1297 |
|
break; |
1298 |
|
else |
1309 |
|
static { |
1310 |
|
try { |
1311 |
|
UNSAFE = getUnsafe(); |
1312 |
< |
Class k = LinkedTransferQueue.class; |
1312 |
> |
Class<?> k = LinkedTransferQueue.class; |
1313 |
|
headOffset = UNSAFE.objectFieldOffset |
1314 |
|
(k.getDeclaredField("head")); |
1315 |
|
tailOffset = UNSAFE.objectFieldOffset |