1291 |
|
} |
1292 |
|
|
1293 |
|
/** |
1294 |
< |
* Atomically sets the tag value for this task. |
1294 |
> |
* Atomically sets the tag value for this task and returns the old value. |
1295 |
|
* |
1296 |
< |
* @param tag the tag value |
1296 |
> |
* @param newValue the new tag value |
1297 |
|
* @return the previous value of the tag |
1298 |
|
* @since 1.8 |
1299 |
|
*/ |
1300 |
< |
public final short setForkJoinTaskTag(short tag) { |
1300 |
> |
public final short setForkJoinTaskTag(short newValue) { |
1301 |
|
for (int s;;) { |
1302 |
|
if (U.compareAndSwapInt(this, STATUS, s = status, |
1303 |
< |
(s & ~SMASK) | (tag & SMASK))) |
1303 |
> |
(s & ~SMASK) | (newValue & SMASK))) |
1304 |
|
return (short)s; |
1305 |
|
} |
1306 |
|
} |
1313 |
|
* before processing, otherwise exiting because the node has |
1314 |
|
* already been visited. |
1315 |
|
* |
1316 |
< |
* @param e the expected tag value |
1317 |
< |
* @param tag the new tag value |
1316 |
> |
* @param expect the expected tag value |
1317 |
> |
* @param update the new tag value |
1318 |
|
* @return {@code true} if successful; i.e., the current value was |
1319 |
< |
* equal to e and is now tag. |
1319 |
> |
* equal to {@code expect} and was changed to {@code update}. |
1320 |
|
* @since 1.8 |
1321 |
|
*/ |
1322 |
< |
public final boolean compareAndSetForkJoinTaskTag(short e, short tag) { |
1322 |
> |
public final boolean compareAndSetForkJoinTaskTag(short expect, short update) { |
1323 |
|
for (int s;;) { |
1324 |
< |
if ((short)(s = status) != e) |
1324 |
> |
if ((short)(s = status) != expect) |
1325 |
|
return false; |
1326 |
|
if (U.compareAndSwapInt(this, STATUS, s, |
1327 |
< |
(s & ~SMASK) | (tag & SMASK))) |
1327 |
> |
(s & ~SMASK) | (update & SMASK))) |
1328 |
|
return true; |
1329 |
|
} |
1330 |
|
} |