C# Class BitSharper.Threading.Execution.ThreadPoolExecutor.Worker

Class Worker mainly maintains interrupt control state for threads running tasks, along with other minor bookkeeping. This class opportunistically extends ReentrantLock to simplify acquiring and releasing a lock surrounding each task execution. This protects against interrupts that are intended to wake up a worker thread waiting for a task from instead interrupting a task being run.
Inheritance: BitSharper.Threading.Locks.ReentrantLock, IRunnable
Show file Open project: TangibleCryptography/BitSharper

Protected Properties

Property Type Description
CompletedTasks uint
FirstTask IRunnable
Thread Thread

Public Methods

Method Description
Run ( ) : void

Runs the associated task, signalling the ThreadPoolExecutor when exiting.

Private Methods

Method Description
Worker ( ThreadPoolExecutor parentThreadPoolExecutor, IRunnable firstTask ) : System

Default Constructor

Method Details

Run() public method

Runs the associated task, signalling the ThreadPoolExecutor when exiting.
public Run ( ) : void
return void

Property Details

CompletedTasks protected property

Per thread completed task counter; accumulated into completedTaskCount upon termination.
protected uint CompletedTasks
return uint

FirstTask protected property

Initial task to run before entering run loop
protected IRunnable FirstTask
return IRunnable

Thread protected property

Thread this worker is running in. Acts as a final field, but cannot be set until thread is created.
protected Thread Thread
return Thread