From 532f3e7bae955f8da4c2028bc462134ed10ff414 Mon Sep 17 00:00:00 2001
From: Pixel <pixel@nobis-crew.org>
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/LuaTask.h |  2 +-
 includes/Task.h    | 20 ++++++++++++++------
 2 files changed, 15 insertions(+), 7 deletions(-)

(limited to 'includes')

diff --git a/includes/LuaTask.h b/includes/LuaTask.h
index ee9d7a7..5058578 100644
--- a/includes/LuaTask.h
+++ b/includes/LuaTask.h
@@ -60,7 +60,7 @@ class LuaMainTask : public Task {
     void exec(LuaExecCell * cell);
     virtual void Do();
     Lua L;
-    Queue<LuaExecCell> m_queue;
+    TQueue<LuaExecCell> m_queue;
     volatile bool m_stopping;
     friend class LuaExecCell;
 };
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;
 };
 
 };
-- 
cgit v1.2.3