TNL::ThreadQueue Class Reference
#include <tnlThread.h>
Inheritance diagram for TNL::ThreadQueue:
Detailed Description
Managing object for a queue of worker threads that pass messages back and forth to the main thread.
ThreadQueue methods declared with the TNL_DECLARE_THREADQ_METHOD macro are special -- if they are called from the main thread, they will be executed on one of the worker threads and vice versa.
Constructor & Destructor Documentation
TNL::ThreadQueue::ThreadQueue |
( |
U32 |
threadCount |
) |
|
|
|
ThreadQueue constructor. threadCount specifies the number of worker threads that will be created.
|
Member Function Documentation
void TNL::ThreadQueue::lock |
( |
|
) |
[inline, protected] |
|
void TNL::ThreadQueue::unlock |
( |
|
) |
[inline, protected] |
|
void TNL::ThreadQueue::postCall |
( |
Functor * |
theCall |
) |
[protected] |
|
|
Posts a marshalled call onto either the worker thread call list or the response call list.
|
void TNL::ThreadQueue::dispatchNextCall |
( |
|
) |
[protected] |
|
|
Dispatches the next available worker thread call. Called internally by the worker threads when they awaken from the semaphore.
|
bool TNL::ThreadQueue::isMainThread |
( |
|
) |
[inline, protected] |
|
|
helper function to determine if the currently executing thread is a worker thread or the main thread.
|
ThreadStorage& TNL::ThreadQueue::getStorage |
( |
|
) |
[inline, protected] |
|
virtual void TNL::ThreadQueue::threadStart |
( |
|
) |
[inline, protected, virtual] |
|
|
called by each worker thread when it starts for subclass initialization of worker threads.
|
void TNL::ThreadQueue::dispatchResponseCalls |
( |
|
) |
|
|
|
Dispatches all ThreadQueue calls queued by worker threads.
This should be called periodically from a main loop. |
Friends And Related Function Documentation
Field Documentation
|
list of calls to be processed by the worker threads
|
|
list of calls to be processed by the main thread
|
|
Synchronization variable that manages worker threads.
|
|
Internal Mutex for synchronizing access to thread call vectors.
|
|
Storage variable that tracks whether this is the main thread or a worker thread.
|