summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2015-01-14 11:34:43 -0500
committerEric Milkie <milkie@10gen.com>2015-01-14 14:54:37 -0500
commitec1736b050bff0dd5a4ef8037d951e58a8e21da3 (patch)
tree2a843f358d788899d6c267b0ec8e5f7877144e1f /src/mongo
parente9ea48278ef98f6c51a4722108026e2f31ca201e (diff)
downloadmongo-ec1736b050bff0dd5a4ef8037d951e58a8e21da3.tar.gz
SERVER-16834 bgsync::shutdown() now unblocks threads waiting in BlockingQueue::push()
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/repl/bgsync.cpp3
-rw-r--r--src/mongo/util/queue.h1
2 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp
index f9868c17ded..8b4166a7476 100644
--- a/src/mongo/db/repl/bgsync.cpp
+++ b/src/mongo/db/repl/bgsync.cpp
@@ -122,6 +122,9 @@ namespace {
void BackgroundSync::shutdown() {
boost::lock_guard<boost::mutex> lock(_mutex);
+ // Clear the buffer in case the producerThread is waiting in push() due to a full queue.
+ _buffer.clear();
+
// Wake up producerThread so it notices that we're in shutdown
_condvar.notify_all();
}
diff --git a/src/mongo/util/queue.h b/src/mongo/util/queue.h
index 5f87256657f..d6faaccddcc 100644
--- a/src/mongo/util/queue.h
+++ b/src/mongo/util/queue.h
@@ -112,6 +112,7 @@ namespace mongo {
scoped_lock l(_lock);
_queue = std::queue<T>();
_currentSize = 0;
+ _cvNoLongerFull.notify_one();
}
bool tryPop( T & t ) {