TaskGroup

Description

sealed class Tinman.Core.Threading.Pooling.TaskGroup

Derived from

Disposable abstract

The TaskGroup class represents a group of tasks.

To run all TaskFlags.Synchronized tasks in a group, call RunSynchronized. To cancel the tasks in a group, use Cancel.

Public / Constructors

Task​Group


public constructor TaskGroup → (1)

name in : string

[not-empty]
The task group name. This is usually the name of the class that creates the task group.

Creates a new instance of TaskGroup.

Public / Methods

Cancel


[ThreadSafe]
public method Cancel → (1)

wait in : bool

true to wait for pending group tasks, false to return immediately.

Cancels all queued tasks in this group and optionally waits for all pending ones to terminate.

Upon disposal, this method is called automatically with true being passed to wait in.

Run​Synchronized


[ThreadSafe]
public method RunSynchronized → ()

returns → bool

true if at least one task has been run, false if there are no pending tasks.

Runs all pending tasks in this given group that are flagged with TaskFlags.Synchronized in the callers thread.

Public / Attributes

Monitor


public attribute Monitor → (get)

value : Monitor

[not-null]
The synchronization monitor.

A synchronization monitor that belongs to this task group.

Name


public attribute Name → (get)

value : string

[not-empty]
The full name.

Returns the full name of this task group.