C# Class TransportService.ThreadPoolObject

This class represents a single object of the ThreadPool. It contains a Thread using the paradigm AsOne in order to hide proper methods of a thread class. Each thread has a condition state that indicates wheather the thread is busy or free.
Show file Open project: zencoders/sambatyon Class Usage Examples

Public Methods

Method Description
AssignAndStart ( Delegate d ) : void

Method called by extern requestors to assign a delegate to execute to the class. This method put the thread in BUSY state and reset the AutoResetEvent. It then start the inner thread passing using an internal delegate function and passing the delegate to it.

ThreadPoolObject ( ) : System

Default construtor. It is used to create a new ThreadPoolObject and to initialize the internal AutoResetEvent.

Private Methods

Method Description
assignAndStartDelegate ( Delegate d ) : void

Private method used to run a delegate passed. This method is passed (with irony as a Delegate) to the internal thread of the class that executes it and so the delegate passed. After the execution is terminated the thread is put in FREE state and the ResetEvent is set.

Method Details

AssignAndStart() public method

Method called by extern requestors to assign a delegate to execute to the class. This method put the thread in BUSY state and reset the AutoResetEvent. It then start the inner thread passing using an internal delegate function and passing the delegate to it.
public AssignAndStart ( Delegate d ) : void
d System.Delegate
return void

ThreadPoolObject() public method

Default construtor. It is used to create a new ThreadPoolObject and to initialize the internal AutoResetEvent.
public ThreadPoolObject ( ) : System
return System