Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

TNL::ThreadQueue Class Reference

Managing object for a queue of worker threads that pass messages back and forth to the main thread. More...

#include <tnlThread.h>

Inheritance diagram for TNL::ThreadQueue:

TNL::Object List of all members.

Public Methods

 ThreadQueue (U32 threadCount)
 ThreadQueue constructor. threadCount specifies the number of worker threads that will be created.

void dispatchResponseCalls ()
 Dispatches all ThreadQueue calls queued by worker threads.


Protected Methods

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.

virtual void threadStart ()
 called by each worker thread when it starts for subclass initialization of worker threads.


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.

Definition at line 151 of file tnlThread.h.


Member Function Documentation

void TNL::ThreadQueue::dispatchResponseCalls  
 

Dispatches all ThreadQueue calls queued by worker threads.

This should be called periodically from a main loop.

Definition at line 287 of file thread.cpp.

References TNL::Vector< Functor * >::clear(), TNL::Functor::dispatch(), lock(), TNL::Vector< Functor * >::size(), and unlock().


The documentation for this class was generated from the following files:
Generated on Thu Aug 18 16:03:39 2005 for Robin Hood: Thieves & Knights by doxygen1.2.18