C# Class Amib.Threading.Internal.WorkItem

Holds a callback delegate and the state for that delegate.
Inheritance: IHasWorkItemPriority
Datei anzeigen Open project: amibar/SmartThreadPool Class Usage Examples

Private Properties

Property Type Description
Cancel bool
ExecuteWorkItem void
FireWorkItemCompleted void
FireWorkItemStarted void
GetResult object
GetResult object
GetWaitHandle System.Threading.WaitHandle
GetWaitHandles void
GetWorkItemResult IWorkItemResult
GetWorkItemState WorkItemState
Initialize void
IsValidStatesTransition bool
PostExecute void
ReleaseWaitHandle void
ReleaseWaitHandles void
SetResult void
SetWorkItemState void
SignalComplete void
WaitAll bool
WaitAny int
WasQueuedBy bool
WorkItemIsQueued void

Public Methods

Method Description
DisposeOfState ( ) : void
Execute ( ) : void

Execute the work item and the post execute

StartingWorkItem ( ) : bool

Change the state of the work item to in progress if it wasn't canceled.

WorkItem ( IWorkItemsGroup workItemsGroup, WorkItemInfo workItemInfo, WorkItemCallback callback, object state ) : System

Initialize the callback holding object.

Private Methods

Method Description
Cancel ( bool abortExecution ) : bool

Cancel the work item if it didn't start running yet.

ExecuteWorkItem ( ) : void

Execute the work item

FireWorkItemCompleted ( ) : void
FireWorkItemStarted ( ) : void
GetResult ( int millisecondsTimeout, bool exitContext, WaitHandle cancelWaitHandle ) : object

Get the result of the work item. If the work item didn't run yet then the caller waits for the result, timeout, or cancel. In case of error the method throws and exception

GetResult ( int millisecondsTimeout, bool exitContext, WaitHandle cancelWaitHandle, Exception &e ) : object

Get the result of the work item. If the work item didn't run yet then the caller waits for the result, timeout, or cancel. In case of error the e argument is filled with the exception

GetWaitHandle ( ) : WaitHandle

A wait handle to wait for completion, cancel, or timeout

GetWaitHandles ( IWaitableResult waitableResults, WaitHandle waitHandles ) : void

Fill an array of wait handles with the work items wait handles.

GetWorkItemResult ( ) : IWorkItemResult

Returns the work item result

GetWorkItemState ( ) : WorkItemState
Initialize ( ) : void
IsValidStatesTransition ( WorkItemState currentState, WorkItemState nextState ) : bool
PostExecute ( ) : void

Runs the post execute callback

ReleaseWaitHandle ( ) : void
ReleaseWaitHandles ( IWaitableResult waitableResults ) : void

Release the work items' wait handles

SetResult ( object result, Exception exception ) : void

Set the result of the work item to return

SetWorkItemState ( WorkItemState workItemState ) : void

Sets the work item's state

SignalComplete ( bool canceled ) : void

Signals that work item has been completed or canceled

WaitAll ( IWaitableResult waitableResults, int millisecondsTimeout, bool exitContext, WaitHandle cancelWaitHandle ) : bool

Wait for all work items to complete

WaitAny ( IWaitableResult waitableResults, int millisecondsTimeout, bool exitContext, WaitHandle cancelWaitHandle ) : int

Waits for any of the work items in the specified array to complete, cancel, or timeout

WasQueuedBy ( IWorkItemsGroup workItemsGroup ) : bool
WorkItemIsQueued ( ) : void

Method Details

DisposeOfState() public method

public DisposeOfState ( ) : void
return void

Execute() public method

Execute the work item and the post execute
public Execute ( ) : void
return void

StartingWorkItem() public method

Change the state of the work item to in progress if it wasn't canceled.
public StartingWorkItem ( ) : bool
return bool

WorkItem() public method

Initialize the callback holding object.
public WorkItem ( IWorkItemsGroup workItemsGroup, WorkItemInfo workItemInfo, WorkItemCallback callback, object state ) : System
workItemsGroup IWorkItemsGroup The workItemGroup of the workitem
workItemInfo Amib.Threading.WorkItemInfo The WorkItemInfo of te workitem
callback WorkItemCallback Callback delegate for the callback.
state object State with which to call the callback delegate.
return System