Skip to content

WorkOption

ZjzMisaka edited this page Dec 17, 2025 · 15 revisions

Properties

The custom work ID. If set to null, the thread pool will use a Guid as the work ID.

string CustomWorkID;

The group name of the work.

string Group;

The maximum amount of time the work is allowed to run before it is terminated.

TimeoutOption TimeoutOption;

The callback function that is called when the work finishes execution.

Action<ExecuteResult<TResult>> Callback;

The priority level of the work. Works with higher priority (represented by higher numerical values) are executed first.

int WorkPriority;

Specifies the scheduling priority of a System.Threading.Thread.

ThreadPriority ThreadPriority;

Get/Set backgroundness of thread in thread pool.

bool IsBackground;

A set of works that this work depends on. This work will not start until all dependent works have completed execution.

ConcurrentSet<WorkID> Dependents;

Is long running work.

bool LongRunning;

Retry the work if execute failed.

RetryOption RetryOption;

Should storage the work result.

bool ShouldStoreResult;

Indicates whether the work should be placed in the local worker's queue if possible.

WorkPlacementPolicy WorkPlacementPolicy;

Indicates whether to automatically check for task stop when posting an async continuation.

bool AutoCheckStopOnAsyncTask;

Enums

enum WorkPlacementPolicy { PreferLocalWorker, PreferIdleThenLocal, PreferIdleThenLeastLoaded };

Clone this wiki locally