diff options
author | Pixel <pixel@nobis-crew.org> | 2012-04-03 09:30:58 -0700 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2012-04-03 09:30:58 -0700 |
commit | 532f3e7bae955f8da4c2028bc462134ed10ff414 (patch) | |
tree | 239b1dfc5cf4694cfba375d1306dc8bbe2b5b4b8 /includes/Task.h | |
parent | 37221dc091725c6fea09181b845308ab8f26c795 (diff) |
Slightly more change to the Queue system, so Debug mode doesn't freak pout.
Diffstat (limited to 'includes/Task.h')
-rw-r--r-- | includes/Task.h | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/includes/Task.h b/includes/Task.h index 01d5e3f..343580b 100644 --- a/includes/Task.h +++ b/includes/Task.h @@ -174,9 +174,9 @@ class QueueBase { bool isEmpty() { ScopeLock sl(m_lock); return !m_front; } protected: QueueBase() : m_front(NULL), m_back(NULL) { pthread_cond_init(&m_cond, NULL); } - ~QueueBase() { while (!isEmpty()) iPop(false); pthread_cond_destroy(&m_cond); } - void iPush(void * t); - void * iPop(bool wait); + ~QueueBase() { while (!isEmpty()) iPop(NULL); pthread_cond_destroy(&m_cond); } + void iPush(void * t, Events::Async * event); + void * iPop(Events::Async * event); private: QueueBase(const QueueBase &) = delete; @@ -191,14 +191,22 @@ class QueueBase { }; Cell * m_front, * m_back; pthread_cond_t m_cond; - Events::Async m_event; }; template<class T> class Queue : public QueueBase { public: - void push(T * t) { iPush(t); } - T * pop(bool wait = true) { return (T *) iPop(wait); } + void push(T * t) { iPush(t, NULL); } + T * pop() { return (T *) iPop(NULL); } +}; + +template<class T> +class TQueue : public QueueBase { + public: + void push(T * t) { iPush(t, &m_event); } + T * pop() { return (T *) iPop(&m_event); } + private: + Events::Async m_event; }; }; |