MB-20054: Fix windows build error by adding size() func in class AtomicQueue 96/65596/2
authorManu Dhundi <manu@couchbase.com>
Thu, 7 Jul 2016 21:28:52 +0000 (14:28 -0700)
committerManu Dhundi <manu@couchbase.com>
Thu, 7 Jul 2016 22:26:10 +0000 (22:26 +0000)
Change-Id: I808e31c9a9ba97b67e75c07534350aa91cb040a2
Reviewed-on: http://review.couchbase.org/65596
Well-Formed: buildbot <build@couchbase.com>
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Sriram Ganesan <sriram@couchbase.com>
Reviewed-by: Will Gardner <will.gardner@couchbase.com>
src/atomicqueue.h

index 531ac32..2b777ee 100644 (file)
@@ -51,6 +51,13 @@ public:
         return queue.empty();
     }
 
+    /**
+     * Return the number of queued items.
+     */
+    size_t size() {
+        std::lock_guard<std::mutex> lock(mutex);
+        return queue.size();
+    }
 private:
     std::queue<T> queue;
     std::mutex mutex;