#include <ThreadQueue.h>
Inheritance diagram for ZThread::ThreadQueue:
Public Member Functions | |
~ThreadQueue () | |
void | insertUserThread (ThreadImpl *) |
void | insertPendingThread (ThreadImpl *) |
void | insertReferenceThread (ThreadImpl *) |
void | insertShutdownTask (Task &) |
bool | removeShutdownTask (const Task &) |
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.
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.