#include <tnlThread.h>
Inheritance diagram for TNL::ThreadQueue:

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.
Public Member Functions | |
| ThreadQueue (U32 threadCount) | |
| ThreadQueue constructor. threadCount specifies the number of worker threads that will be created. | |
| ~ThreadQueue () | |
| void | dispatchResponseCalls () |
| Dispatches all ThreadQueue calls queued by worker threads. | |
Protected Member Functions | |
| void | lock () |
| Locks the ThreadQueue for access to member variables. | |
| void | unlock () |
| Unlocks the ThreadQueue. | |
| void | postCall (Functor *theCall) |
| Posts a marshalled call onto either the worker thread call list or the response call list. | |
| void | dispatchNextCall () |
| Dispatches the next available worker thread call. Called internally by the worker threads when they awaken from the semaphore. | |
| bool | isMainThread () |
| helper function to determine if the currently executing thread is a worker thread or the main thread. | |
| ThreadStorage & | getStorage () |
| virtual void | threadStart () |
| called by each worker thread when it starts for subclass initialization of worker threads. | |
Private Attributes | |
| Vector< Thread * > | mThreads |
| list of worker threads on this ThreadQueue | |
| Vector< Functor * > | mThreadCalls |
| list of calls to be processed by the worker threads | |
| Vector< Functor * > | mResponseCalls |
| list of calls to be processed by the main thread | |
| Semaphore | mSemaphore |
| Synchronization variable that manages worker threads. | |
| Mutex | mLock |
| Internal Mutex for synchronizing access to thread call vectors. | |
| ThreadStorage | mStorage |
| Storage variable that tracks whether this is the main thread or a worker thread. | |
Friends | |
| class | ThreadQueueThread |
|
|
ThreadQueue constructor. threadCount specifies the number of worker threads that will be created.
|
|
|
|
|
|
Locks the ThreadQueue for access to member variables.
|
|
|
Unlocks the ThreadQueue.
|
|
|
Posts a marshalled call onto either the worker thread call list or the response call list.
|
|
|
Dispatches the next available worker thread call. Called internally by the worker threads when they awaken from the semaphore.
|
|
|
helper function to determine if the currently executing thread is a worker thread or the main thread.
|
|
|
|
|
|
called by each worker thread when it starts for subclass initialization of worker threads.
|
|
|
Dispatches all ThreadQueue calls queued by worker threads. This should be called periodically from a main loop. |
|
|
|
|
|
list of worker threads on this ThreadQueue
|
|
|
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.
|