WorkQueue

Queues supporting work-stealing as well as external task submission. See above for descriptions and algorithms.

Constructors

this
this(ForkJoinPool pool, ForkJoinWorkerThread owner)
Undocumented in source.

Members

Functions

cancelAll
void cancelAll()

Removes and cancels all known tasks, ignoring any exceptions.

getPoolIndex
int getPoolIndex()

Returns an exportable index (used by ForkJoinWorkerThread).

growArray
void growArray(bool locked)

Doubles the capacity of array. Call either by owner or with lock held -- it is OK for base, but not top, to move while resizings are in progress.

helpAsyncBlocker
void helpAsyncBlocker(ManagedBlocker blocker)

Tries to poll and run AsynchronousCompletionTasks until none found or blocker is released

helpCC
int helpCC(ICountedCompleter task, int limit, bool isShared)

Tries to pop and run tasks within the target's computation until done, not found, or limit exceeded.

isApparentlyUnblocked
bool isApparentlyUnblocked()

Returns true if owned and not known to be blocked.

isEmpty
bool isEmpty()

Provides a more accurate estimate of whether this queue has any tasks than does queueSize, by checking whether a near-empty queue has at least one unclaimed task.

lockedPush
bool lockedPush(IForkJoinTask task)

Version of push for shared queues. Call only with phase lock held. @return true if should signal work

nextLocalTask
IForkJoinTask nextLocalTask()

Takes next task, if one exists, in order specified by mode.

peek
IForkJoinTask peek()

Returns next task, if one exists, in order specified by mode.

poll
IForkJoinTask poll()

Takes next task, if one exists, in FIFO order.

push
void push(IForkJoinTask task)

Pushes a task. Call only by owner in unshared queues.

queueSize
int queueSize()

Returns the approximate number of tasks in the queue.

releasePhaseLock
void releasePhaseLock()
Undocumented in source. Be warned that the author may not have intended to support it.
topLevelExec
void topLevelExec(IForkJoinTask t, WorkQueue q, int n)

Runs the given (stolen) task if nonnull, as well as remaining local tasks and others available from the given queue, up to bound n (to avoid infinite unfairness).

tryLockPhase
bool tryLockPhase()

Tries to lock shared queue by CASing phase field.

tryLockedUnpush
bool tryLockedUnpush(IForkJoinTask task)

Shared version of tryUnpush.

tryRemoveAndExec
void tryRemoveAndExec(IForkJoinTask task)

If present, removes task from queue and executes it.

tryUnpush
bool tryUnpush(IForkJoinTask task)

Pops the given task only if it is at the current top.

Variables

array
IForkJoinTask[] array;
Undocumented in source.
base
int base;
Undocumented in source.
id
int id;
Undocumented in source.
nsteals
int nsteals;
Undocumented in source.
owner
ForkJoinWorkerThread owner;
Undocumented in source.
phase
int phase;
Undocumented in source.
pool
ForkJoinPool pool;
Undocumented in source.
source
int source;
Undocumented in source.
stackPred
int stackPred;
Undocumented in source.
top
int top;
Undocumented in source.

Meta