ForkJoinTask.compareAndSetForkJoinTaskTag

Atomically conditionally sets the tag value for this task. Among other applications, tags can be used as visit markers in tasks operating on graphs, as in methods that check: {@code if (task.compareAndSetForkJoinTaskTag((short)0, (short)1))} before processing, otherwise exiting because the node has already been visited.

@param expect the expected tag value @param update the new tag value @return {@code true} if successful; i.e., the current value was equal to {@code expect} and was changed to {@code update}.

class ForkJoinTask(V)
final
bool
compareAndSetForkJoinTaskTag
(
short expect
,
short update
)

Meta