![]() |
VR-Forces Developer's Guide
|
Simple asynchronous callback queue.

Classes | |
| class | CallbackInterface |
| struct | Record |
| struct | ThreadInfo |
Public Types | |
| typedef boost::function< void()> | Callback |
Public Member Functions | |
| DtVrfCallbackQueue (const std::string &label, unsigned maxTasks) | |
| virtual | ~DtVrfCallbackQueue () |
| virtual std::string | label () const |
| virtual void | setWarnTime (double seconds) |
| virtual void | setWarnTime (double seconds, std::ostream &output) |
| virtual void | printInfo (std::ostream &, size_t width=0) const |
| virtual size_t | totalNumberOfCallbacks () const |
| virtual unsigned | size () const |
| virtual size_t | numExecuting () const |
| virtual unsigned | maxTasks () const |
| virtual void | setMaxTasks (unsigned tasks, bool wait=true) |
| void | shutdown (bool wait=true) |
| virtual void | clear (bool wait=true) |
| virtual void | add_back (const Callback &, const std::string &label="") |
| virtual void | add_front (const Callback &, const std::string &label="") |
| virtual void | add_back (CallbackInterface *) |
| virtual void | add_front (CallbackInterface *) |
| virtual void | add_back (const CallbackInterface::Ptr &) |
| virtual void | add_front (const CallbackInterface::Ptr &) |
| virtual void | add_back (CallbackInterface &) |
| virtual void | add_front (CallbackInterface &) |
| virtual bool | runOne (bool block=false, ThreadInfo *info=0) |
| virtual void | runAll (bool useThisThread=false) |
Static Public Member Functions | |
| static void | cleanup () |
Private Types | |
| typedef std::mutex | Mutex |
| typedef std::condition_variable | Condition |
| typedef std::unique_lock< Mutex > | Lock |
| typedef std::multimap< double, std::ostream *, std::greater < double > > | StreamMap |
Private Member Functions | |
| virtual bool | pop (CallbackInterface::Ptr &, bool block=true, ThreadInfo *info=0) |
| void | execute (ThreadInfo *) |
Private Attributes | |
| Mutex | myMutex |
| Condition | myCondition |
| Condition | myDoneCondition |
| ThreadInfo::List | myThreads |
| Record::List | myCallbacks |
| bool | myShutdownFlag |
| size_t | myTotalNumCallbacks |
| std::atomic< size_t > | myNumExecuting |
| DtConsoleCommandManager * | myConsoleManager |
| std::string | myLabel |
| StreamMap | myWarnTimes |
Friends | |
| struct | ThreadInfo |
| typedef boost::function<void ()> DtVrfCallbackQueue::Callback |
|
private |
|
private |
|
private |
|
private |
|
explicit |
Constructor.
| maxTasks | max number of threads. |
|
virtual |
Virtual destructor.
|
virtual |
Get label of callback queue.
|
static |
Cleans up global memory.
|
virtual |
Queue will print warns when jobs are queued for longer than this.
|
virtual |
|
virtual |
Print detailed info to stream.
|
virtual |
Total number of callbacks added to the queue that have not finished executing.
|
virtual |
Number of jobs currently on the queue waiting to be executed.
|
virtual |
Current number of callbacks executing their callbacks right now.
|
virtual |
Current max number concurrent of tasks.
Set max number of tasks.
| wait | if true will wait for threads to exit. |
| void DtVrfCallbackQueue::shutdown | ( | bool | wait = true | ) |
Notify all threads to shutdown. Not virtual because it is called in the destructor.
| wait | If true function will wait for all threads to end. |
|
virtual |
Remove all tasks.
|
virtual |
Add a job to the back of the queue.
|
virtual |
Add a job to the front of the queue.
|
virtual |
Add a job to the back of the queue.
|
virtual |
Add a job to the front of the queue.
|
virtual |
Add a job to the back of the queue.
|
virtual |
Add a job to the front of the queue.
|
virtual |
Add a job to the back of the queue. Caller is responsible for lifetime of callback.
|
virtual |
Add a job to the front of the queue Caller is responsible for lifetime of callback.
|
virtual |
Pop and run one job from front of queue.
| block | if true this function will wait for a job if the queue is empty. |
| info | ThreadInfo data structure for this thread if it's managed by this object. |
|
virtual |
Will not return until the queue has empty.
| useThisThread | if true will run callbacks with this thread, otherwise will wait. If there are no threads this parameter is ignored. |
|
privatevirtual |
Pop a job from the queue, if it's empty block.
| block | if true this function will wait for a job if the queue is empty. |
| info | ThreadInfo data structure for this thread if it's managed by this object. |
|
private |
Thread main.
|
friend |
|
mutableprivate |
|
mutableprivate |
|
mutableprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |