From 532f3e7bae955f8da4c2028bc462134ed10ff414 Mon Sep 17 00:00:00 2001 From: Pixel Date: Tue, 3 Apr 2012 09:30:58 -0700 Subject: Slightly more change to the Queue system, so Debug mode doesn't freak pout. --- includes/Task.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'includes/Task.h') 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 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 TQueue : public QueueBase { + public: + void push(T * t) { iPush(t, &m_event); } + T * pop() { return (T *) iPop(&m_event); } + private: + Events::Async m_event; }; }; -- cgit v1.2.3