Udostępnij za pośrednictwem


ForkJoinTask.SurplusQueuedTaskCount Property

Definition

Returns an estimate of how many more locally queued tasks are held by the current worker thread than there are other worker threads that might steal them, or zero if this thread is not operating in a ForkJoinPool.

public static int SurplusQueuedTaskCount { [Android.Runtime.Register("getSurplusQueuedTaskCount", "()I", "")] get; }
[<get: Android.Runtime.Register("getSurplusQueuedTaskCount", "()I", "")>]
static member SurplusQueuedTaskCount : int

Property Value

the surplus number of tasks, which may be negative

Attributes

Remarks

Returns an estimate of how many more locally queued tasks are held by the current worker thread than there are other worker threads that might steal them, or zero if this thread is not operating in a ForkJoinPool. This value may be useful for heuristic decisions about whether to fork other tasks. In many usages of ForkJoinTasks, at steady state, each worker should aim to maintain a small constant surplus (for example, 3) of tasks, and to process computations locally if this threshold is exceeded.

Java documentation for java.util.concurrent.ForkJoinTask.getSurplusQueuedTaskCount().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to