changeset 2080:bb93de4f4562

merge
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 07 Sep 2016 09:05:35 +0200
parents acb4cd4af771 (current diff) 93afa6134ab3 (diff)
children 681e9ea81581
files
diffstat 2 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Core/MultiThreading/SharedMessageQueue.cpp	Wed Sep 07 09:03:37 2016 +0200
+++ b/Core/MultiThreading/SharedMessageQueue.cpp	Wed Sep 07 09:05:35 2016 +0200
@@ -185,4 +185,24 @@
     boost::mutex::scoped_lock lock(mutex_);
     isFifo_ = false;
   }
+
+  void SharedMessageQueue::Clear()
+  {
+    boost::mutex::scoped_lock lock(mutex_);
+
+    if (queue_.empty())
+    {
+      return;
+    }
+    else
+    {
+      while (!queue_.empty())
+      {
+        std::auto_ptr<IDynamicObject> message(queue_.front());
+        queue_.pop_front();
+      }
+
+      emptied_.notify_all();
+    }
+  }
 }
--- a/Core/MultiThreading/SharedMessageQueue.h	Wed Sep 07 09:03:37 2016 +0200
+++ b/Core/MultiThreading/SharedMessageQueue.h	Wed Sep 07 09:05:35 2016 +0200
@@ -78,5 +78,7 @@
     void SetFifoPolicy();
 
     void SetLifoPolicy();
+
+    void Clear();
   };
 }