68 #ifndef CGU_ASYNC_QUEUE_H
69 #define CGU_ASYNC_QUEUE_H
82 #ifdef CGU_USE_SCHED_YIELD
98 virtual const char*
what()
const throw() {
return "AsyncQueuePopError: popping from empty AsyncQueue object\n";}
139 template <
class T,
class Container = std::list<T> >
class AsyncQueue {
147 std::queue<T, Container> q;
160 #ifdef CGU_USE_SCHED_YIELD
210 q.push(std::move(obj));
236 template<
class... Args>
239 q.emplace(std::forward<Args>(args)...);
302 obj = std::move(q.front());
369 if (
this != &other) {
370 lock2(mutex, other.mutex);
401 lock2(mutex, rhs.mutex);
404 std::queue<T, Container> temp{rhs.q};
435 q = std::move(rhs.q);
575 std::queue<T, Container> q;
589 #ifdef CGU_USE_SCHED_YIELD
640 q.push(std::move(obj));
667 template<
class... Args>
670 q.emplace(std::forward<Args>(args)...);
734 obj = std::move(q.front());
762 while (q.empty()) cond.
wait(mutex);
803 while (q.empty()) cond.
wait(mutex);
805 obj = std::move(q.front());
895 obj = std::move(q.front());
968 if (
this != &other) {
969 lock2(mutex, other.mutex);
974 if (!other.q.empty()) other.cond.
broadcast();
1013 lock2(mutex, rhs.mutex);
1016 std::queue<T, Container> temp{rhs.q};
1055 q = std::move(rhs.q);
1151 q((Thread::Mutex::Lock(rhs.mutex), rhs.q)) {}
1190 template <
class T,
class Container>
1219 template <
class T,
class Container>