|
.NET Framework | |||||||||
PREV TYPE NEXT TYPE | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONST | PROP | METHOD | OP | EVENT | DETAIL: FIELD | CONST | PROP | METHOD | OP | EVENT |
A nicer Thread Pooler. The inbuilt .NET pooler is prone to being swamped by lots of work requests. This one handles things a bit better.
Field Summary | |
---|---|
System.Threading.Thread | maintainThread |
int | maxWorkerAgeMins |
System.Threading.ManualResetEvent | mre |
int |
poolMaxSize
Maximum number of worker threads used |
System.Threading.ManualResetEvent | poolMRE |
System.Collections.Queue | queue |
int |
threadsInUse
Use tiuLock for access |
System.Threading.ReaderWriterLock | tiuLock |
Constructor Summary | |
---|---|
WorkPool() Initializes a new instance of the WorkPool class. |
|
WorkPool(int poolSize) Constructor |
Method Summary | |
---|---|
int |
Cancel(Naanou.Common.IWorkItem item, int removedCount) Cancels a work item |
void |
Queue(Naanou.Common.IWorkItem item) Queues a work item |
void |
SignalDone(Naanou.Common.WorkPool.WorkerThread t) Signal that worker is complete |
void |
Start() Starts the dispatcher running |
void |
StartImpl() Starts pool management |
Methods inherited from class System.Object |
---|
Equals, Finalize, GetHashCode, GetType, MemberwiseClone, ToString |
Field Detail |
---|
protected System.Threading.Thread maintainThread
protected int maxWorkerAgeMins
protected System.Threading.ManualResetEvent mre
protected int poolMaxSize
Maximum number of worker threads used
protected System.Threading.ManualResetEvent poolMRE
protected System.Collections.Queue queue
protected int threadsInUse
Use tiuLock for access
protected System.Threading.ReaderWriterLock tiuLock
Constructor Detail |
---|
public WorkPool()
Initializes a new instance of the WorkPool class.
public WorkPool(int poolSize)
Constructor
Method Detail |
---|
public int Cancel(Naanou.Common.IWorkItem item, int removedCount)
Cancels a work item
Parameters:
item
- found
- public void Queue(Naanou.Common.IWorkItem item)
Queues a work item
Parameters:
item
- Itemprivate void SignalDone(Naanou.Common.WorkPool.WorkerThread t)
Signal that worker is complete
Parameters:
t
- Workerprivate void Start()
Starts the dispatcher running
Throws:
System.InvalidOperationException
- Already runningprivate void StartImpl()
Starts pool management
|
.NET Framework | |||||||||
PREV TYPE NEXT TYPE | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONST | PROP | METHOD | OP | EVENT | DETAIL: FIELD | CONST | PROP | METHOD | OP | EVENT |