76 |
|
* |
77 |
|
* A FIFO dual queue may be implemented using a variation of the |
78 |
|
* Michael & Scott (M&S) lock-free queue algorithm |
79 |
< |
* (http://www.cs.rochester.edu/u/scott/papers/1996_PODC_queues.pdf). |
79 |
> |
* (http://www.cs.rochester.edu/~scott/papers/1996_PODC_queues.pdf). |
80 |
|
* It maintains two pointer fields, "head", pointing to a |
81 |
|
* (matched) node that in turn points to the first actual |
82 |
|
* (unmatched) queue node (or null if empty); and "tail" that |
678 |
|
s.forgetContents(); // avoid garbage |
679 |
|
return LinkedTransferQueue.<E>cast(item); |
680 |
|
} |
681 |
< |
if ((w.isInterrupted() || (timed && nanos <= 0)) && |
681 |
> |
if ((w.isInterrupted() || (timed && nanos <= 0L)) && |
682 |
|
s.casItem(e, s)) { // cancel |
683 |
|
unsplice(pred, s); |
684 |
|
return e; |
1331 |
|
static sun.misc.Unsafe getUnsafe() { |
1332 |
|
try { |
1333 |
|
return sun.misc.Unsafe.getUnsafe(); |
1334 |
< |
} catch (SecurityException se) { |
1335 |
< |
try { |
1336 |
< |
return java.security.AccessController.doPrivileged |
1337 |
< |
(new java.security |
1338 |
< |
.PrivilegedExceptionAction<sun.misc.Unsafe>() { |
1339 |
< |
public sun.misc.Unsafe run() throws Exception { |
1340 |
< |
java.lang.reflect.Field f = sun.misc |
1341 |
< |
.Unsafe.class.getDeclaredField("theUnsafe"); |
1342 |
< |
f.setAccessible(true); |
1343 |
< |
return (sun.misc.Unsafe) f.get(null); |
1344 |
< |
}}); |
1345 |
< |
} catch (java.security.PrivilegedActionException e) { |
1346 |
< |
throw new RuntimeException("Could not initialize intrinsics", |
1347 |
< |
e.getCause()); |
1348 |
< |
} |
1334 |
> |
} catch (SecurityException tryReflectionInstead) {} |
1335 |
> |
try { |
1336 |
> |
return java.security.AccessController.doPrivileged |
1337 |
> |
(new java.security.PrivilegedExceptionAction<sun.misc.Unsafe>() { |
1338 |
> |
public sun.misc.Unsafe run() throws Exception { |
1339 |
> |
Class<sun.misc.Unsafe> k = sun.misc.Unsafe.class; |
1340 |
> |
for (java.lang.reflect.Field f : k.getDeclaredFields()) { |
1341 |
> |
f.setAccessible(true); |
1342 |
> |
Object x = f.get(null); |
1343 |
> |
if (k.isInstance(x)) |
1344 |
> |
return k.cast(x); |
1345 |
> |
} |
1346 |
> |
throw new NoSuchFieldError("the Unsafe"); |
1347 |
> |
}}); |
1348 |
> |
} catch (java.security.PrivilegedActionException e) { |
1349 |
> |
throw new RuntimeException("Could not initialize intrinsics", |
1350 |
> |
e.getCause()); |
1351 |
|
} |
1352 |
|
} |
1351 |
– |
|
1353 |
|
} |