107 |
|
* in general sensible to serialize tasks only before or after, but |
108 |
|
* not during execution. Serialization is not relied on during |
109 |
|
* execution itself. |
110 |
+ |
* |
111 |
+ |
* @since 1.7 |
112 |
+ |
* @author Doug Lea |
113 |
|
*/ |
114 |
|
public abstract class ForkJoinTask<V> implements Future<V>, Serializable { |
115 |
|
|
165 |
|
} |
166 |
|
|
167 |
|
final boolean casStatus(int cmp, int val) { |
168 |
< |
return _unsafe.compareAndSwapInt(this, statusOffset, cmp, val); |
168 |
> |
return UNSAFE.compareAndSwapInt(this, statusOffset, cmp, val); |
169 |
|
} |
170 |
|
|
171 |
|
/** |
173 |
|
*/ |
174 |
|
static void rethrowException(Throwable ex) { |
175 |
|
if (ex != null) |
176 |
< |
_unsafe.throwException(ex); |
176 |
> |
UNSAFE.throwException(ex); |
177 |
|
} |
178 |
|
|
179 |
|
// Setting completion status |
216 |
|
final void setNormalCompletion() { |
217 |
|
// Try typical fast case -- single CAS, no signal, not already done. |
218 |
|
// Manually expand casStatus to improve chances of inlining it |
219 |
< |
if (!_unsafe.compareAndSwapInt(this, statusOffset, 0, NORMAL)) |
219 |
> |
if (!UNSAFE.compareAndSwapInt(this, statusOffset, 0, NORMAL)) |
220 |
|
setCompletion(NORMAL); |
221 |
|
} |
222 |
|
|
1056 |
|
|
1057 |
|
private static long fieldOffset(String fieldName) |
1058 |
|
throws NoSuchFieldException { |
1059 |
< |
return _unsafe.objectFieldOffset |
1059 |
> |
return UNSAFE.objectFieldOffset |
1060 |
|
(ForkJoinTask.class.getDeclaredField(fieldName)); |
1061 |
|
} |
1062 |
|
|
1063 |
< |
static final Unsafe _unsafe; |
1063 |
> |
static final Unsafe UNSAFE; |
1064 |
|
static final long statusOffset; |
1065 |
|
|
1066 |
|
static { |
1067 |
|
try { |
1068 |
< |
_unsafe = getUnsafe(); |
1068 |
> |
UNSAFE = getUnsafe(); |
1069 |
|
statusOffset = fieldOffset("status"); |
1070 |
|
} catch (Throwable e) { |
1071 |
|
throw new RuntimeException("Could not initialize intrinsics", e); |