15 #include <boost/function.hpp>
16 #include <boost/noncopyable.hpp>
17 #include <tbb/tick_count.h>
24 #include <condition_variable>
32 #ifdef DtObjectDebugger_Enable
36 typedef std::shared_ptr<ThreadInfo>
Ptr;
37 typedef std::list<Ptr>
List;
56 #ifdef DtObjectDebugger_Enable
61 typedef std::shared_ptr<CallbackInterface>
Ptr;
70 virtual std::string label()
const;
73 virtual void run() = 0;
76 virtual void cancel();
79 virtual bool valid()
const;
85 const std::string& label,
92 virtual std::string label()
const;
95 static void cleanup();
98 virtual void setWarnTime(
double seconds);
99 virtual void setWarnTime(
double seconds, std::ostream& output);
102 virtual void printInfo(std::ostream&,
size_t width=0)
const;
105 virtual size_t totalNumberOfCallbacks()
const;
108 virtual unsigned size()
const;
111 virtual size_t numExecuting()
const;
114 virtual unsigned maxTasks()
const;
118 virtual void setMaxTasks(
unsigned tasks,
bool wait=
true);
123 void shutdown(
bool wait =
true);
126 virtual void clear(
bool wait =
true);
129 virtual void add_back(
const Callback&,
const std::string& label =
"");
132 virtual void add_front(
const Callback&,
const std::string& label =
"");
160 virtual bool runOne(
bool block=
false,
ThreadInfo* info=0);
165 virtual void runAll(
bool useThisThread=
false);
180 #ifdef DtObjectDebugger_Enable
184 typedef std::list<Record>
List;
195 typedef std::unique_lock<Mutex>
Lock;
213 typedef std::multimap<double, std::ostream*, std::greater<double> >
StreamMap;
std::string name
Definition: vrfCallbackQueue.h:42
Definition: vrfCallbackQueue.h:217
Definition: vrfCallbackQueue.h:31
virtual void cancel() override
Will be called if the callback will not be run before it's discarded.
Definition: vrfCallbackQueue.h:228
Record::List myCallbacks
Definition: vrfCallbackQueue.h:202
ThreadInfo::List myThreads
Definition: vrfCallbackQueue.h:201
std::thread thread
Definition: vrfCallbackQueue.h:43
virtual void cancel() override
Will be called if the callback will not be run before it's discarded.
Definition: vrfCallbackQueue.h:244
DtVrfCallbackQueue::CallbackInterface & myCallback
Definition: vrfCallbackQueue.h:247
voidpf void uLong size
Definition: ioapi.h:39
const tbb::tick_count timeAdded
Definition: vrfCallbackQueue.h:187
Condition myCondition
Definition: vrfCallbackQueue.h:198
#define DT_DEFINE_OBJECT_DEBUGGER_NAME(type)
Definition: objectCounter.h:31
Default on in debug, off in release.
Definition: objectCounter.h:27
Simple asynchronous callback queue.
Definition: vrfCallbackQueue.h:29
virtual void run()=0
Run callback.
std::unique_lock< Mutex > Lock
Definition: vrfCallbackQueue.h:195
std::atomic< size_t > myNumExecuting
Definition: vrfCallbackQueue.h:207
This is a class which maintains a list of string command names and the callback functions that are to...
Definition: consoleCommandManager.h:56
Definition: vrfCallbackQueue.h:234
Callback record.
Definition: vrfCallbackQueue.h:179
boost::function< void()> Callback
Definition: vrfCallbackQueue.h:52
std::string myLabel
Definition: vrfCallbackQueue.h:211
std::list< Ptr > List
Definition: vrfCallbackQueue.h:37
std::shared_ptr< CallbackInterface > Ptr
Definition: vrfCallbackQueue.h:61
virtual std::string label() const override
Name of callback, used only for logging and debugging.
Definition: vrfCallbackQueue.h:226
virtual void cancel()
Will be called if the callback will not be run before it's discarded.
API for writing callbacks.
Definition: vrfCallbackQueue.h:55
RefWrapper(DtVrfCallbackQueue::CallbackInterface &i)
Definition: vrfCallbackQueue.h:238
size_t myTotalNumCallbacks
Definition: vrfCallbackQueue.h:205
Condition myDoneCondition
Definition: vrfCallbackQueue.h:199
bool myShutdownFlag
Definition: vrfCallbackQueue.h:204
std::list< Record > List
Definition: vrfCallbackQueue.h:184
std::multimap< double, std::ostream *, std::greater< double > > StreamMap
Definition: vrfCallbackQueue.h:213
virtual void run() override
Run callback.
Definition: vrfCallbackQueue.h:227
DtVrfCallbackQueue::CallbackInterface * myCallback
Definition: vrfCallbackQueue.h:231
virtual ~Wrapper() override
Definition: vrfCallbackQueue.h:225
std::shared_ptr< ThreadInfo > Ptr
Definition: vrfCallbackQueue.h:36
const CallbackInterface::Ptr callback
Definition: vrfCallbackQueue.h:186
#define DT_DLL_vrfutil
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfutilDefines.h:34
virtual std::string label() const override
Name of callback, used only for logging and debugging.
Definition: vrfCallbackQueue.h:242
std::condition_variable Condition
Definition: vrfCallbackQueue.h:194
bool quitFlag
Definition: vrfCallbackQueue.h:41
virtual void run() override
Run callback.
Definition: vrfCallbackQueue.h:243
Wrapper(DtVrfCallbackQueue::CallbackInterface *i)
Definition: vrfCallbackQueue.h:221
virtual std::string label() const
Name of callback, used only for logging and debugging.
StreamMap myWarnTimes
Definition: vrfCallbackQueue.h:214
std::mutex Mutex
Definition: vrfCallbackQueue.h:193
DtConsoleCommandManager * myConsoleManager
Definition: vrfCallbackQueue.h:209
Mutex myMutex
Definition: vrfCallbackQueue.h:197