ZThread::ThreadQueue Class Reference

#include <ThreadQueue.h>

Inheritance diagram for ZThread::ThreadQueue:

ZThread::Singleton< T, InstantiationPolicy, LockType > ZThread::NonCopyable List of all members.

Public Member Functions

 ~ThreadQueue ()
void insertUserThread (ThreadImpl *)
void insertPendingThread (ThreadImpl *)
void insertReferenceThread (ThreadImpl *)
void insertShutdownTask (Task &)
bool removeShutdownTask (const Task &)

Detailed Description

Version:
2.3.0
Author:
Eric Crahen <http://www.code-foo.com>
Date:
<2003-07-27T20:52:05-0400>
A ThreadQueue accumulates references to user and reference threads. These are threads that are running outside the scope of the Thread object that created them. ZThreads doesn't have a central manager for all threads (partly why I renamed the ThreadManager to someting more appropriate). Instead, ZThreads will discover threads it did not create and create a reference thread that allows ZThreads to interact with it. Non user threads that are created by the user never have to touch the ThreadQueue.


Constructor & Destructor Documentation

ZThread::ThreadQueue::~ThreadQueue (  ) 

The thread destroys a ThreadQueue will be a reference thread, probably the main thread; but it could be another thread that started and loaded the library.


Member Function Documentation

void ZThread::ThreadQueue::insertPendingThread ( ThreadImpl  ) 

Insert a pending-thread into the queue.

Pending-threads are known to have completed thier tasks and thier resources are reclaimed (lazily) as more threads are started or as the ThreadQueue is destroyed.

void ZThread::ThreadQueue::insertReferenceThread ( ThreadImpl  ) 

Insert reference thread. Reference threads are not removed until the ThreadQueue goes out of scope.

void ZThread::ThreadQueue::insertShutdownTask ( Task  ) 

Insert a task to be run before threads are joined. Any items inserted after the ThreadQueue desctructor has begun to execute will be run() immediately.

void ZThread::ThreadQueue::insertUserThread ( ThreadImpl  ) 

Insert a user-thread into the queue. User-threads are inserted as they begin thier task. Once that task completes, user-threads are automatically transitioned to pending-threads via insertPendingThread().

User-threads are known to be executing thier tasks and will be cancel()ed as the ThreadQueue is destroyed when main() goes out of scope. This sends a request to the task to complete soon. Once the task exits, the thread is transitioned to pending-thread status.

bool ZThread::ThreadQueue::removeShutdownTask ( const Task  ) 

Remove an existing shutdown task.


The documentation for this class was generated from the following files:
Generated on Wed Aug 30 03:27:49 2006 for SWG EMU by  doxygen 1.4.7