C# Class EpLibrary.cs.BaseWorkerThread

A class that implements Base Worker Thread Class.
Inheritance: ThreadEx
Show file Open project: juhgiyo/EpLibrary.cs Class Usage Examples

Protected Properties

Property Type Description
m_callBackFunc Action
m_callBackLock Object
m_jobProcessor EpLibrary.cs.BaseJobProcessor
m_lifePolicy ThreadLifePolicy
m_workPool JobScheduleQueue

Public Methods

Method Description
BaseWorkerThread ( BaseWorkerThread b ) : System

Default copy constructor

BaseWorkerThread ( ThreadLifePolicy policy ) : System

Default Constructor

Erase ( BaseJob work ) : bool

Erase the given work from the work pool.

Front ( ) : BaseJob

Get First Job in the Job Queue.

GetJobCount ( ) : int

Get job count in work pool.

GetJobProcessor ( ) : EpLibrary.cs.BaseJobProcessor

Get Job Processor.

GetLifePolicy ( ) : ThreadLifePolicy

Return the life policy of this worker thread.

Pop ( ) : BaseJob

Pop a work from the work pool.

Push ( BaseJob work ) : void

Push in the new work to the work pool.

SetCallBackClass ( Action callBackFunc ) : void

Set call back class to call when work is done.

SetJobProcessor ( EpLibrary.cs.BaseJobProcessor jobProcessor ) : void

Set new Job Processor.

TerminateWorker ( int waitTimeInMilliSec = Timeout.Infinite ) : TerminateResult

Wait for worker thread to terminate, and if not terminated, then Terminate.

Protected Methods

Method Description
callCallBack ( ) : void

Call the Call Back Class if callback class is assigned.

execute ( ) : void

Pure Worker Thread Code.

Method Details

BaseWorkerThread() public method

Default copy constructor
public BaseWorkerThread ( BaseWorkerThread b ) : System
b BaseWorkerThread the object to copy from
return System

BaseWorkerThread() public method

Default Constructor
public BaseWorkerThread ( ThreadLifePolicy policy ) : System
policy ThreadLifePolicy the life policy of this worker thread.
return System

Erase() public method

Erase the given work from the work pool.
public Erase ( BaseJob work ) : bool
work BaseJob the work to erase from the work pool
return bool

Front() public method

Get First Job in the Job Queue.
public Front ( ) : BaseJob
return BaseJob

GetJobCount() public method

Get job count in work pool.
public GetJobCount ( ) : int
return int

GetJobProcessor() public method

Get Job Processor.
public GetJobProcessor ( ) : EpLibrary.cs.BaseJobProcessor
return EpLibrary.cs.BaseJobProcessor

GetLifePolicy() public method

Return the life policy of this worker thread.
public GetLifePolicy ( ) : ThreadLifePolicy
return ThreadLifePolicy

Pop() public method

Pop a work from the work pool.
public Pop ( ) : BaseJob
return BaseJob

Push() public method

Push in the new work to the work pool.
public Push ( BaseJob work ) : void
work BaseJob the new work to put into the work pool.
return void

SetCallBackClass() public method

Set call back class to call when work is done.
public SetCallBackClass ( Action callBackFunc ) : void
callBackFunc Action the call back function.
return void

SetJobProcessor() public method

Set new Job Processor.
public SetJobProcessor ( EpLibrary.cs.BaseJobProcessor jobProcessor ) : void
jobProcessor EpLibrary.cs.BaseJobProcessor set new Job Processor for this thread.
return void

TerminateWorker() public method

Wait for worker thread to terminate, and if not terminated, then Terminate.
public TerminateWorker ( int waitTimeInMilliSec = Timeout.Infinite ) : TerminateResult
waitTimeInMilliSec int the time-out interval, in milliseconds.
return TerminateResult

callCallBack() protected method

Call the Call Back Class if callback class is assigned.
protected callCallBack ( ) : void
return void

execute() protected abstract method

Pure Worker Thread Code.
protected abstract execute ( ) : void
return void

Property Details

m_callBackFunc protected property

the call back class
protected Action m_callBackFunc
return Action

m_callBackLock protected property

callback Lock
protected Object m_callBackLock
return Object

m_jobProcessor protected property

Job Processor
protected BaseJobProcessor,EpLibrary.cs m_jobProcessor
return EpLibrary.cs.BaseJobProcessor

m_lifePolicy protected property

the life policy of the thread
protected ThreadLifePolicy m_lifePolicy
return ThreadLifePolicy

m_workPool protected property

the work list
protected JobScheduleQueue m_workPool
return JobScheduleQueue