Table of Contents

Class WaitTask

Namespace
NanoByte.Common.Threading
Assembly
NanoByte.Common.dll

Waits for a System.Threading.WaitHandle to become available or the System.Threading.CancellationToken to be triggered.

public sealed class WaitTask : TaskBase, ITask
Inheritance
object
MarshalByRefObject
WaitTask
Implements
Inherited Members
Extension Methods

Constructors

WaitTask(string, WaitHandle?, int)

Waits for a System.Threading.WaitHandle to become available or the System.Threading.CancellationToken to be triggered.

public WaitTask(string name, WaitHandle? waitHandle = null, int millisecondsTimeout = -1)

Parameters

name string

A name describing the task in human-readable form.

waitHandle WaitHandle

The System.Threading.WaitHandle to wait for; null to wait for System.Threading.CancellationToken.

millisecondsTimeout int

The number of milliseconds to wait before raising System.TimeoutException; System.Threading.Timeout.Infinite to wait indefinitely.

Properties

Name

A name describing the task in human-readable form.

public override string Name { get; }

Property Value

string

PreventIdle

Indicates whether this task should prevent the system from entering idle mode.

protected override bool PreventIdle { get; }

Property Value

bool

UnitsByte

true if UnitsProcessed and UnitsTotal are measured in bytes; false if they are measured in generic units.

protected override bool UnitsByte { get; }

Property Value

bool

Methods

Execute()

The actual code to be executed.

protected override void Execute()

Remarks

State is automatically set to Started before calling this method, to Complete after a successful exit and to an appropriate error state in case on an exception. You can set additional TaskStates during execution.

Exceptions

OperationCanceledException

The operation was canceled.

IOException

The task ended with IOError.

WebException

The task ended with WebError.