TaskScheduler.TryDequeue(Task) Method

Definition

Attempts to dequeue a Task that was previously queued to this scheduler.

protected public:
 virtual bool TryDequeue(System::Threading::Tasks::Task ^ task);
protected internal virtual bool TryDequeue (System.Threading.Tasks.Task task);
[System.Security.SecurityCritical]
protected internal virtual bool TryDequeue (System.Threading.Tasks.Task task);
abstract member TryDequeue : System.Threading.Tasks.Task -> bool
override this.TryDequeue : System.Threading.Tasks.Task -> bool
[<System.Security.SecurityCritical>]
abstract member TryDequeue : System.Threading.Tasks.Task -> bool
override this.TryDequeue : System.Threading.Tasks.Task -> bool
Protected Friend Overridable Function TryDequeue (task As Task) As Boolean

Parameters

task
Task

The Task to be dequeued.

Returns

Boolean

A Boolean denoting whether the task argument was successfully dequeued.

Attributes

Exceptions

The task argument is null.

Remarks

For more information, see TaskScheduler.

This method may execute in a finally block; therefore it should return as quickly as possible so that any resources such as CancellationTokenRegistration objects can be disposed of in a timely manner.

Applies to

See also