From 3eae716a2d19c4161e6d4f3f82831094f30e8874 Mon Sep 17 00:00:00 2001 From: hagen Date: Sun, 27 Mar 2016 00:00:00 +0000 Subject: [PATCH] * drop MsgQueue wrapper : not used anymore --- Queue.h | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) diff --git a/Queue.h b/Queue.h index 6f50e189..b47a19c8 100644 --- a/Queue.h +++ b/Queue.h @@ -117,52 +117,6 @@ namespace util std::mutex m_QueueMutex; std::condition_variable m_NonEmpty; }; - - template - class MsgQueue: public Queue - { - public: - - typedef std::function OnEmpty; - - MsgQueue (): m_IsRunning (true), m_Thread (std::bind (&MsgQueue::Run, this)) {}; - ~MsgQueue () { Stop (); }; - void Stop() - { - if (m_IsRunning) - { - m_IsRunning = false; - Queue::WakeUp (); - m_Thread.join(); - } - } - - void SetOnEmpty (OnEmpty const & e) { m_OnEmpty = e; }; - - private: - - void Run () - { - while (m_IsRunning) - { - while (auto msg = Queue::Get ()) - { - msg->Process (); - delete msg; - } - if (m_OnEmpty != nullptr) - m_OnEmpty (); - if (m_IsRunning) - Queue::Wait (); - } - } - - private: - - volatile bool m_IsRunning; - OnEmpty m_OnEmpty; - std::thread m_Thread; - }; } }