13 #ifndef __UT_ThreadQueue__
14 #define __UT_ThreadQueue__
48 return myList.entries();
59 item = std::move(myList.popFirst());
61 myCurrentCost -= cost;
74 while (!
remove(result))
123 return myList.entries();
136 return myList.entries();
145 { appendImpl(item, cost); }
147 { appendImpl(std::move(item), cost); }
154 return !myList.entries();
157 template <
typename S>
158 void appendImpl(
S &&item,
exint cost)
166 if (cost && myMaxCost >= 0 && (myCurrentCost > 0) && (myCurrentCost + cost > myMaxCost))
179 myList.push(std::forward<S>(item));
181 myCurrentCost += cost;
bool waitForTriggerMS(UT_Lock &lock, int64 timeout_msec)
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
SYS_NO_DISCARD_RESULT T popFirst()
**But if you need a result
bool waitAndRemoveMS(T &item, int64 timeout_ms)
int waitForQueueChangeMS(int64 timeout_ms)
Condition synchronization primitive.
UT_ThreadQueue(exint maxcost=-1)
A max cost of -1 will never block on adding items to the queue.
void waitForTrigger(UT_Lock &lock)
void append(const T &item, exint cost=0)
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
void append(T &&item, exint cost=0)
T waitAndRemove()
Blocks until the item is ready.
int entries() const
Prohibit copying as I am not sure if lock semantics will work.