Class WaitTask
Waits for a WaitHandle to become available or the CancellationToken to be triggered.
public sealed class WaitTask : TaskBase, ITask
- Inheritance
-
objectMarshalByRefObjectWaitTask
- Implements
- Inherited Members
- Extension Methods
Constructors
WaitTask(string, WaitHandle?, int)
Waits for a WaitHandle to become available or the CancellationToken to be triggered.
public WaitTask(string name, WaitHandle? waitHandle = null, int millisecondsTimeout = -1)
Parameters
namestringA name describing the task in human-readable form.
waitHandleWaitHandleThe WaitHandle to wait for;
nullto wait for CancellationToken.millisecondsTimeoutintThe number of milliseconds to wait before raising TimeoutException; Infinite to wait indefinitely.
Properties
Name
A name describing the task in human-readable form.
public override string Name { get; }
Property Value
PreventIdle
Indicates whether this task should prevent the system from entering idle mode.
protected override bool PreventIdle { get; }
Property Value
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
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.