Utilities Layer

This layer has various utility classes that is used by the various other layers in the project.

TSList: This class is a thread safe list which uses the Interlocked.CompareExchange to implement a spin lock as opposed to a full memory lock to access the data. This is implemented as a circularly linked list, which helps both the push and the pop to reference the same variable and hence get access without locking. Please note, this can only be used with a push and a pop. Pop will remove the object from the list.

StrictObjectPool: A Strict Object Pool is a pool of objects stored in a TSList. The pool can scale from a set of minimum objects configured to a set of maximum objects configured. Once an object is got from the pool to do a work, this object is marked as inuse and cannot be used for other work until the object is released back to the free pool. The pool will also allow for configuration of a wait time to wait for an object to be released when all objects are in use. This pool will not create objects beyond the maximum size configured size. This object pool will only pool objects implementing the interface IPoolableObject. It will use a provided IPoolableObjectCreator to create new objects into the pool. A Default Creator template is provided that can create objects that support default constructors.

MSThread: This is an object that will be pooled in the MSThreadPool. This object will wait for a task to be assigned to the thread and once assigned will wakeup and execute the task and go back to waiting. This object will only execute IGatedTask objects.

MSThreadPool: This is a strict pool of MSThread objects. This class will be used by the ThreadPoolExecutor to be a able to schedule and execute multiple tasks with a maximum number of executing threads equal to the maximum pool size. Any extra tasks are scheduled and executed as soon as a thread is available.

Executor: An executor is provided will allows execution of tasks in different ways. The supported executions are Synchronous execution, implemented in the SynchronousExecutor class, asynchronous execution implemented in the AsynchronousExecutor class and execution in a thread pool implemented in the ThreadPoolExecutor class.

ByteBuffer: This is a variable buffer for storing bytes.

Pipeline: This implements the pipeline functionality. The class is thread safe and data can be added first, last or in the middle. Data can be accessed in the order in which it is piped.

Last edited Jan 17, 2011 at 11:44 AM by rsankarx, version 1

Comments

No comments yet.