]> git.seodisparate.com - UDPConnection/commitdiff
Add missing impl fn to TSLQueue
authorStephen Seo <seo.disparate@gmail.com>
Thu, 24 Oct 2019 08:51:40 +0000 (17:51 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Thu, 24 Oct 2019 08:51:40 +0000 (17:51 +0900)
cpp_impl/src/TSLQueue.hpp

index fd42df84ac9675d169319fab3d6e1fdab15e9f33..c4fafe98fb0bec482bbe1111da21e58dac5aad09 100644 (file)
@@ -222,6 +222,15 @@ void TSLQueue<T>::clear() {
     iterWrapperCount = std::make_shared<void>();
 }
 
+template <typename T>
+bool TSLQueue<T>::empty() {
+    while(iterWrapperCount.use_count() > 1) {
+        std::this_thread::sleep_for(std::chrono::milliseconds(10));
+    }
+    std::lock_guard lock(mutex);
+    return container.empty();
+}
+
 template <typename T>
 template <bool isConst, bool isRev>
 TSLQueue<T>::TSLQIterWrapper<isConst, isRev>::TSLQIterWrapper(