9 #ifndef __PDG_EventQueue_h__
10 #define __PDG_EventQueue_h__
23 #define PDG_EVENT_QUEUE_STATS 0
93 {
return myIsConsolidateEvents; }
97 { myIsConsolidateEvents = consolidate; }
121 using EventInfo = std::pair<const PDG_EventEmitter*, PDG_Event>;
123 using EventQueue = UT_ConcurrentQueue<EventInfo>;
124 using EmitterMap = UT_ConcurrentHashMap<PDG_EventEmitter*, EmitterInfo>;
132 const EventArray& events)
134 , myEvents(events) {}
140 for (
int64 i = range.begin();
144 myQueue->processEvent(myEvents[i]);
149 const EventArray& myEvents;
159 bool addEventHandler(
164 void removeEventHandler(
168 void removeAllEventHandlers(
172 void findEventHandlers(
176 void processQueueStats(
int print_limit);
177 void processEvent(
const EventInfo& info);
178 void processEvents();
181 { myPauseRequests.add(1); }
183 { myPauseRequests.add(-1); }
185 static void* runThread(
void*
param);
189 EmitterArrayMap myEmitters;
193 #if PDG_EVENT_QUEUE_STATS
194 exint myDropEventCount;
195 exint myQueuedEventCount;
196 exint myPoppedEventCount;
197 exint myProcessedEventCount;
198 exint myQueueLogTime;
201 exint myEmitterMapSize;
204 bool myIsTerminating;
207 bool myIsConsolidateEvents;
bool isConsolidateEvents() const
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the queue
void setConsolidateEvents(bool consolidate)
Configures the event consolidation flag.
void pause(int delay) noexcept
ScopedPause(PDG_EventQueue *queue)
ImageBuf OIIO_API add(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter