diff options
author | Adam Midvidy <amidvidy@gmail.com> | 2015-06-18 11:18:11 -0400 |
---|---|---|
committer | Adam Midvidy <amidvidy@gmail.com> | 2015-06-18 15:32:33 -0400 |
commit | 9bb8d65d8d6c58fa325e81ad8f0d7d067a66f413 (patch) | |
tree | 516cf7fbefc28e3cf925a084f873e8af985543e9 /src | |
parent | 94543115f64345f3bb74b2508b1b319d6b6cf68d (diff) | |
download | mongo-9bb8d65d8d6c58fa325e81ad8f0d7d067a66f413.tar.gz |
SERVER-18723 boost -> stdx for condition_variable
Diffstat (limited to 'src')
41 files changed, 91 insertions, 96 deletions
diff --git a/src/mongo/client/replica_set_monitor.cpp b/src/mongo/client/replica_set_monitor.cpp index bfadcc339c3..cad15d3899a 100644 --- a/src/mongo/client/replica_set_monitor.cpp +++ b/src/mongo/client/replica_set_monitor.cpp @@ -32,13 +32,13 @@ #include "mongo/client/replica_set_monitor.h" #include <algorithm> -#include <boost/thread/condition.hpp> #include <limits> -#include "mongo/db/server_options.h" #include "mongo/client/connpool.h" #include "mongo/client/global_conn_pool.h" #include "mongo/client/replica_set_monitor_internal.h" +#include "mongo/db/server_options.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/thread.h" #include "mongo/util/background.h" #include "mongo/util/concurrency/mutex.h" // for StaticObserver @@ -184,7 +184,7 @@ namespace { mongo::mutex _monitorMutex; bool _started; - boost::condition _stopRequestedCV; + stdx::condition_variable _stopRequestedCV; bool _stopRequested; } replicaSetMonitorWatcher; diff --git a/src/mongo/client/replica_set_monitor_internal.h b/src/mongo/client/replica_set_monitor_internal.h index a0168d21dcf..0220e004a80 100644 --- a/src/mongo/client/replica_set_monitor_internal.h +++ b/src/mongo/client/replica_set_monitor_internal.h @@ -33,7 +33,6 @@ #pragma once -#include <boost/thread/condition.hpp> #include <deque> #include <set> #include <string> @@ -45,6 +44,7 @@ #include "mongo/db/jsobj.h" #include "mongo/platform/cstdint.h" #include "mongo/platform/random.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/util/net/hostandport.h" namespace mongo { @@ -171,7 +171,7 @@ namespace mongo { // progress. // TODO consider splitting cv into two: one for when looking for a master, one for all other // cases. - boost::condition_variable cv; + stdx::condition_variable cv; const std::string name; // safe to read outside lock since it is const int consecutiveFailedScans; diff --git a/src/mongo/db/auth/authorization_manager.h b/src/mongo/db/auth/authorization_manager.h index d168fdf8eec..8f7afa9f3fc 100644 --- a/src/mongo/db/auth/authorization_manager.h +++ b/src/mongo/db/auth/authorization_manager.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/thread/condition_variable.hpp> #include <memory> #include <string> @@ -45,6 +44,7 @@ #include "mongo/db/jsobj.h" #include "mongo/db/namespace_string.h" #include "mongo/platform/unordered_map.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" @@ -406,7 +406,7 @@ namespace mongo { * Condition used to signal that it is OK for another CacheGuard to enter a fetch phase. * Manipulated via CacheGuard. */ - boost::condition_variable _fetchPhaseIsReady; + stdx::condition_variable _fetchPhaseIsReady; }; } // namespace mongo diff --git a/src/mongo/db/auth/user_cache_invalidator_job.cpp b/src/mongo/db/auth/user_cache_invalidator_job.cpp index 557214e0fd7..0faaaa84bc6 100644 --- a/src/mongo/db/auth/user_cache_invalidator_job.cpp +++ b/src/mongo/db/auth/user_cache_invalidator_job.cpp @@ -54,7 +54,7 @@ namespace { // How often to check with the config servers whether authorization information has changed. int userCacheInvalidationIntervalSecs = 30; // 30 second default stdx::mutex invalidationIntervalMutex; - boost::condition_variable invalidationIntervalChangedCondition; + stdx::condition_variable invalidationIntervalChangedCondition; Date_t lastInvalidationTime; class ExportedInvalidationIntervalParameter : public ExportedServerParameter<int> { diff --git a/src/mongo/db/background.cpp b/src/mongo/db/background.cpp index 2d492a103b4..fbf46736f98 100644 --- a/src/mongo/db/background.cpp +++ b/src/mongo/db/background.cpp @@ -36,6 +36,7 @@ #include <string> #include "mongo/base/disallow_copying.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/thread.h" #include "mongo/util/assert_util.h" #include "mongo/util/map_util.h" @@ -61,7 +62,7 @@ namespace { private: int _opsInProgCount; - boost::condition_variable _noOpsInProg; + stdx::condition_variable _noOpsInProg; }; typedef StringMap<std::shared_ptr<BgInfo> > BgInfoMap; diff --git a/src/mongo/db/commands/fsync.cpp b/src/mongo/db/commands/fsync.cpp index 90418dce52d..a8b19391d3c 100644 --- a/src/mongo/db/commands/fsync.cpp +++ b/src/mongo/db/commands/fsync.cpp @@ -30,7 +30,6 @@ #include "mongo/db/commands/fsync.h" -#include <boost/thread/condition.hpp> #include <iostream> #include <sstream> #include <string> @@ -45,13 +44,14 @@ #include "mongo/db/auth/authorization_manager.h" #include "mongo/db/auth/authorization_session.h" #include "mongo/db/auth/privilege.h" -#include "mongo/db/concurrency/d_concurrency.h" +#include "mongo/db/client.h" #include "mongo/db/commands.h" +#include "mongo/db/concurrency/d_concurrency.h" +#include "mongo/db/operation_context_impl.h" #include "mongo/db/service_context.h" #include "mongo/db/storage/mmap_v1/dur.h" #include "mongo/db/storage/storage_engine.h" -#include "mongo/db/client.h" -#include "mongo/db/operation_context_impl.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/util/background.h" #include "mongo/util/log.h" @@ -89,8 +89,8 @@ namespace mongo { SimpleMutex m; // protects locked var above string err; - boost::condition _threadSync; - boost::condition _unlockSync; + stdx::condition_variable_any _threadSync; + stdx::condition_variable_any _unlockSync; FSyncCommand() : Command( "fsync" ), m("lockfsync") { locked=false; pendingUnlock=false; } virtual bool isWriteCommandForConfigServer() const { return false; } diff --git a/src/mongo/db/concurrency/lock_manager.h b/src/mongo/db/concurrency/lock_manager.h index a73d57232f3..1d8c054152b 100644 --- a/src/mongo/db/concurrency/lock_manager.h +++ b/src/mongo/db/concurrency/lock_manager.h @@ -28,8 +28,6 @@ #pragma once -#include <boost/thread/condition_variable.hpp> - #include <deque> #include "mongo/config.h" @@ -39,6 +37,7 @@ #include "mongo/platform/compiler.h" #include "mongo/platform/cstdint.h" #include "mongo/platform/unordered_map.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/mutex.h" #include "mongo/util/concurrency/mutex.h" diff --git a/src/mongo/db/concurrency/lock_state.h b/src/mongo/db/concurrency/lock_state.h index b179ae28e80..ca16767eb49 100644 --- a/src/mongo/db/concurrency/lock_state.h +++ b/src/mongo/db/concurrency/lock_state.h @@ -63,7 +63,7 @@ namespace mongo { // These two go together to implement the conditional variable pattern. stdx::mutex _mutex; - boost::condition_variable _cond; + stdx::condition_variable _cond; // Result from the last call to notify LockResult _result; diff --git a/src/mongo/db/index_builder.cpp b/src/mongo/db/index_builder.cpp index ae60503cf7b..9a7927ba0b9 100644 --- a/src/mongo/db/index_builder.cpp +++ b/src/mongo/db/index_builder.cpp @@ -57,7 +57,7 @@ namespace { // parent thread has not yet synchronized with it. bool _bgIndexStarting(false); stdx::mutex _bgIndexStartingMutex; - boost::condition_variable _bgIndexStartingCondVar; + stdx::condition_variable _bgIndexStartingCondVar; void _setBgIndexStarting() { stdx::lock_guard<stdx::mutex> lk(_bgIndexStartingMutex); diff --git a/src/mongo/db/range_deleter.h b/src/mongo/db/range_deleter.h index 4d9db11dd74..db56a86576b 100644 --- a/src/mongo/db/range_deleter.h +++ b/src/mongo/db/range_deleter.h @@ -211,13 +211,13 @@ namespace mongo { // No delete is in progress. Used to make sure that there is no activity // in this deleter, and therefore is safe to destroy it. Must be used in // conjunction with _stopRequested. - boost::condition _nothingInProgressCV; + stdx::condition_variable _nothingInProgressCV; // Protects all the data structure below this. mutable mutex _queueMutex; // _taskQueue has a task ready to work on. - boost::condition _taskQueueNotEmptyCV; + stdx::condition_variable _taskQueueNotEmptyCV; // Queue for storing the list of ranges that have cursors pending on it. // diff --git a/src/mongo/db/range_deleter_mock_env.h b/src/mongo/db/range_deleter_mock_env.h index 02eebb341ab..b4892b99f70 100644 --- a/src/mongo/db/range_deleter_mock_env.h +++ b/src/mongo/db/range_deleter_mock_env.h @@ -147,13 +147,13 @@ namespace mongo { // Protects _pauseDelete & _pausedCount mutex _pauseDeleteMutex; - boost::condition _pausedCV; + stdx::condition_variable _pausedCV; bool _pauseDelete; // Number of times a delete gets paused. uint64_t _pausedCount; // _pausedCount < nthPause (used by waitForNthPausedDelete) - boost::condition _pausedDeleteChangeCV; + stdx::condition_variable _pausedDeleteChangeCV; // Protects all variables below this line. mutex _envStatMutex; @@ -161,6 +161,6 @@ namespace mongo { // Keeps track of the number of times getCursorIds was called. uint64_t _getCursorsCallCount; // _getCursorsCallCount < nthCall (used by waitForNthGetCursor) - boost::condition _cursorsCallCountUpdatedCV; + stdx::condition_variable _cursorsCallCountUpdatedCV; }; } diff --git a/src/mongo/db/repl/bgsync.h b/src/mongo/db/repl/bgsync.h index ee14d380fe9..d1e7e7ea692 100644 --- a/src/mongo/db/repl/bgsync.h +++ b/src/mongo/db/repl/bgsync.h @@ -28,11 +28,10 @@ #pragma once -#include <boost/thread/condition.hpp> - #include "mongo/db/jsobj.h" #include "mongo/db/repl/oplogreader.h" #include "mongo/db/repl/optime.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/mutex.h" #include "mongo/util/queue.h" @@ -152,9 +151,9 @@ namespace repl { // if produce thread should be running bool _pause; - boost::condition _pausedCondition; + stdx::condition_variable _pausedCondition; bool _appliedBuffer; - boost::condition _appliedBufferCondition; + stdx::condition_variable _appliedBufferCondition; HostAndPort _syncSourceHost; diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp index 8e240ecc6dc..5b3d48fbc21 100644 --- a/src/mongo/db/repl/oplog.cpp +++ b/src/mongo/db/repl/oplog.cpp @@ -104,7 +104,7 @@ namespace { // Synchronizes the section where a new Timestamp is generated and when it actually // appears in the oplog. mongo::mutex newOpMutex; - boost::condition newTimestampNotifier; + stdx::condition_variable newTimestampNotifier; static std::string _oplogCollectionName; diff --git a/src/mongo/db/repl/replication_coordinator_external_state_mock.h b/src/mongo/db/repl/replication_coordinator_external_state_mock.h index 117e33cd2a4..1602601a33a 100644 --- a/src/mongo/db/repl/replication_coordinator_external_state_mock.h +++ b/src/mongo/db/repl/replication_coordinator_external_state_mock.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/thread/condition.hpp> #include <vector> #include "mongo/base/disallow_copying.h" @@ -38,6 +37,7 @@ #include "mongo/db/jsobj.h" #include "mongo/db/repl/last_vote.h" #include "mongo/db/repl/replication_coordinator_external_state.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/thread.h" #include "mongo/util/net/hostandport.h" @@ -132,10 +132,10 @@ namespace repl { Status _storeLocalLastVoteDocumentStatus; // mutex and cond var for controlling stroeLocalConfigDocument()'s hanging stdx::mutex _shouldHangConfigMutex; - boost::condition _shouldHangConfigCondVar; + stdx::condition_variable _shouldHangConfigCondVar; // mutex and cond var for controlling stroeLocalLastVoteDocument()'s hanging stdx::mutex _shouldHangLastVoteMutex; - boost::condition _shouldHangLastVoteCondVar; + stdx::condition_variable _shouldHangLastVoteCondVar; bool _storeLocalConfigDocumentShouldHang; bool _storeLocalLastVoteDocumentShouldHang; bool _connectionsClosed; diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp index af29e984e7e..83adf16fdde 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -121,7 +121,7 @@ namespace { unsigned int _opID, const OpTime* _opTime, const WriteConcernOptions* _writeConcern, - boost::condition_variable* _condVar) : list(_list), + stdx::condition_variable* _condVar) : list(_list), master(true), opID(_opID), opTime(_opTime), @@ -139,7 +139,7 @@ namespace { const unsigned int opID; const OpTime* opTime; const WriteConcernOptions* writeConcern; - boost::condition_variable* condVar; + stdx::condition_variable* condVar; }; namespace { @@ -820,7 +820,7 @@ namespace { duration_cast<Milliseconds>(elapsedTime)); } - boost::condition_variable condVar; + stdx::condition_variable condVar; WaiterInfo waitInfo(&_opTimeWaiterList, txn->getOpID(), &ts, @@ -1102,7 +1102,7 @@ namespace { } // Must hold _mutex before constructing waitInfo as it will modify _replicationWaiterList - boost::condition_variable condVar; + stdx::condition_variable condVar; WaiterInfo waitInfo( &_replicationWaiterList, txn->getOpID(), &opTime, &writeConcern, &condVar); while (!_doneWaitingForReplication_inlock(opTime, writeConcern)) { diff --git a/src/mongo/db/repl/replication_coordinator_impl.h b/src/mongo/db/repl/replication_coordinator_impl.h index 2c53a92e936..8fcd9671dae 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.h +++ b/src/mongo/db/repl/replication_coordinator_impl.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/thread/condition_variable.hpp> #include <vector> #include <memory> @@ -47,6 +46,7 @@ #include "mongo/platform/atomic_word.h" #include "mongo/platform/unordered_map.h" #include "mongo/platform/unordered_set.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/util/net/hostandport.h" @@ -982,7 +982,7 @@ namespace repl { bool _isWaitingForDrainToComplete; // (M) // Used to signal threads waiting for changes to _rsConfigState. - boost::condition_variable _rsConfigStateChange; // (M) + stdx::condition_variable _rsConfigStateChange; // (M) // Represents the configuration state of the coordinator, which controls how and when // _rsConfig may change. See the state transition diagram in the type definition of diff --git a/src/mongo/db/repl/replication_executor.h b/src/mongo/db/repl/replication_executor.h index 6574bdef3c6..a6749bb26a4 100644 --- a/src/mongo/db/repl/replication_executor.h +++ b/src/mongo/db/repl/replication_executor.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/thread/condition_variable.hpp> #include <string> #include <thread> @@ -42,6 +41,7 @@ #include "mongo/executor/task_executor.h" #include "mongo/platform/compiler.h" #include "mongo/platform/random.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/functional.h" #include "mongo/stdx/list.h" #include "mongo/stdx/mutex.h" @@ -306,7 +306,7 @@ namespace repl { std::unique_ptr<StorageInterface> _storageInterface; stdx::mutex _mutex; stdx::mutex _terribleExLockSyncMutex; - boost::condition_variable _noMoreWaitingThreads; + stdx::condition_variable _noMoreWaitingThreads; WorkQueue _freeQueue; WorkQueue _readyQueue; WorkQueue _dbWorkInProgressQueue; @@ -398,7 +398,7 @@ namespace repl { // All members other than _executor are protected by the executor's _mutex. bool _isSignaled; - boost::condition_variable _isSignaledCondition; + stdx::condition_variable _isSignaledCondition; EventList::iterator _iter; WorkQueue _waiters; }; diff --git a/src/mongo/db/repl/sync_source_feedback.h b/src/mongo/db/repl/sync_source_feedback.h index 900019cd3e8..ebbd55b1dbf 100644 --- a/src/mongo/db/repl/sync_source_feedback.h +++ b/src/mongo/db/repl/sync_source_feedback.h @@ -29,10 +29,9 @@ #pragma once -#include <boost/thread/condition.hpp> - #include "mongo/client/constants.h" #include "mongo/client/dbclientcursor.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/mutex.h" #include "mongo/util/net/hostandport.h" @@ -85,7 +84,7 @@ namespace repl { // protects cond, _shutdownSignaled, and _positionChanged. stdx::mutex _mtx; // used to alert our thread of changes which need to be passed up the chain - boost::condition _cond; + stdx::condition_variable _cond; // used to indicate a position change which has not yet been pushed along bool _positionChanged; // Once this is set to true the _run method will terminate diff --git a/src/mongo/db/repl/task_runner.h b/src/mongo/db/repl/task_runner.h index 35e707c6905..33e879e08b8 100644 --- a/src/mongo/db/repl/task_runner.h +++ b/src/mongo/db/repl/task_runner.h @@ -28,10 +28,10 @@ #pragma once -#include <boost/thread/condition.hpp> #include <list> #include "mongo/base/disallow_copying.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" @@ -149,7 +149,7 @@ namespace repl { // Protects member data of this TaskRunner. mutable stdx::mutex _mutex; - boost::condition _condition; + stdx::condition_variable _condition; // _active is true when there are scheduled tasks in the task queue or // when a task is being run by the task runner. diff --git a/src/mongo/db/storage/mmap_v1/dur.cpp b/src/mongo/db/storage/mmap_v1/dur.cpp index 24fec0eca41..ec76e172bc5 100644 --- a/src/mongo/db/storage/mmap_v1/dur.cpp +++ b/src/mongo/db/storage/mmap_v1/dur.cpp @@ -73,8 +73,6 @@ #include "mongo/db/storage/mmap_v1/dur.h" -#include <boost/thread/condition_variable.hpp> - #include <iomanip> #include <utility> @@ -91,6 +89,7 @@ #include "mongo/db/storage/mmap_v1/durable_mapped_file.h" #include "mongo/db/storage/mmap_v1/mmap_v1_options.h" #include "mongo/db/storage_options.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/util/concurrency/synchronization.h" @@ -115,7 +114,7 @@ namespace { // Used to activate the flush thread stdx::mutex flushMutex; - boost::condition_variable flushRequested; + stdx::condition_variable flushRequested; // This is waited on for getlasterror acknowledgements. It means that data has been written to // the journal, but not necessarily applied to the shared view, so it is all right to diff --git a/src/mongo/db/storage/mmap_v1/file_allocator.h b/src/mongo/db/storage/mmap_v1/file_allocator.h index cb987b21618..d42850f1aa0 100644 --- a/src/mongo/db/storage/mmap_v1/file_allocator.h +++ b/src/mongo/db/storage/mmap_v1/file_allocator.h @@ -31,8 +31,8 @@ #include <list> #include <boost/filesystem/path.hpp> -#include <boost/thread/condition.hpp> +#include "mongo/stdx/condition_variable.h" #include "mongo/util/concurrency/mutex.h" namespace mongo { @@ -92,7 +92,7 @@ namespace mongo { std::string makeTempFileName( boost::filesystem::path root ); mutable mongo::mutex _pendingMutex; - mutable boost::condition _pendingUpdated; + mutable stdx::condition_variable _pendingUpdated; std::list< std::string > _pending; mutable std::map< std::string, long > _pendingSize; diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp index 19a128b7b98..4c71b448804 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp @@ -30,8 +30,6 @@ #define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kStorage -#include <boost/thread/condition.hpp> - #include "mongo/base/checked_cast.h" #include "mongo/base/init.h" #include "mongo/bson/bsonobjbuilder.h" @@ -40,6 +38,7 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h" #include "mongo/db/storage/wiredtiger/wiredtiger_session_cache.h" #include "mongo/db/storage/wiredtiger/wiredtiger_util.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/mutex.h" #include "mongo/util/concurrency/ticketholder.h" #include "mongo/util/log.h" @@ -74,7 +73,7 @@ namespace mongo { AtomicUInt32 numWaitingForSync; stdx::mutex mutex; // this just protects lastSyncTime - boost::condition condvar; + stdx::condition_variable condvar; long long lastSyncTime; } waitUntilDurableData; } diff --git a/src/mongo/dbtests/documentsourcetests.cpp b/src/mongo/dbtests/documentsourcetests.cpp index d99e8c6e06a..e31ab3aa0e0 100644 --- a/src/mongo/dbtests/documentsourcetests.cpp +++ b/src/mongo/dbtests/documentsourcetests.cpp @@ -30,8 +30,6 @@ #include "mongo/platform/basic.h" -#include <boost/thread/condition.hpp> - #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" #include "mongo/db/db_raii.h" @@ -43,6 +41,7 @@ #include "mongo/db/query/get_executor.h" #include "mongo/db/storage_options.h" #include "mongo/dbtests/dbtests.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/thread.h" namespace DocumentSourceTests { @@ -300,7 +299,7 @@ namespace DocumentSourceTests { private: int _value; mutable mongo::mutex _mutex; - mutable boost::condition _condition; + mutable stdx::condition_variable _condition; }; diff --git a/src/mongo/dbtests/perftests.cpp b/src/mongo/dbtests/perftests.cpp index 459bdb05142..8eec55fe913 100644 --- a/src/mongo/dbtests/perftests.cpp +++ b/src/mongo/dbtests/perftests.cpp @@ -64,6 +64,7 @@ #include "mongo/db/storage_options.h" #include "mongo/dbtests/dbtests.h" #include "mongo/dbtests/framework_options.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/thread.h" #include "mongo/util/allocator.h" #include "mongo/util/checksum.h" @@ -541,7 +542,7 @@ namespace PerfTests { std::mutex mstd; std::timed_mutex mstd_timed; SpinLock s; - boost::condition c; + stdx::condition_variable c; class NotifyOne : public B { public: diff --git a/src/mongo/executor/network_interface_impl.h b/src/mongo/executor/network_interface_impl.h index 9243dd08127..3744bf808b9 100644 --- a/src/mongo/executor/network_interface_impl.h +++ b/src/mongo/executor/network_interface_impl.h @@ -29,11 +29,11 @@ #pragma once -#include <boost/thread/condition_variable.hpp> #include <vector> #include "mongo/client/remote_command_runner_impl.h" #include "mongo/executor/network_interface.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/list.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" @@ -124,7 +124,7 @@ namespace executor { stdx::mutex _mutex; // Condition signaled to indicate that there is work in the _pending queue. - boost::condition_variable _hasPending; + stdx::condition_variable _hasPending; // Queue of yet-to-be-executed network operations. CommandDataList _pending; @@ -144,7 +144,7 @@ namespace executor { // Condition signaled to indicate that the executor, blocked in waitForWorkUntil or // waitForWork, should wake up. - boost::condition_variable _isExecutorRunnableCondition; + stdx::condition_variable _isExecutorRunnableCondition; // Flag indicating whether or not the executor associated with this interface is runnable. bool _isExecutorRunnable; diff --git a/src/mongo/executor/network_interface_mock.h b/src/mongo/executor/network_interface_mock.h index d7709300bd5..ff16f8eff6a 100644 --- a/src/mongo/executor/network_interface_mock.h +++ b/src/mongo/executor/network_interface_mock.h @@ -28,10 +28,10 @@ #pragma once -#include <boost/thread/condition_variable.hpp> #include <map> #include "mongo/executor/network_interface.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/list.h" #include "mongo/stdx/mutex.h" #include "mongo/util/time_support.h" @@ -210,10 +210,10 @@ namespace executor { stdx::mutex _mutex; // Condition signaled to indicate that the network processing thread should wake up. - boost::condition_variable _shouldWakeNetworkCondition; // (M) + stdx::condition_variable _shouldWakeNetworkCondition; // (M) // Condition signaled to indicate that the executor run thread should wake up. - boost::condition_variable _shouldWakeExecutorCondition; // (M) + stdx::condition_variable _shouldWakeExecutorCondition; // (M) // Bitmask indicating which threads are runnable. int _waitingToRunMask; // (M) diff --git a/src/mongo/s/catalog/legacy/catalog_manager_legacy.h b/src/mongo/s/catalog/legacy/catalog_manager_legacy.h index 6afd75e2026..aff0ce6d185 100644 --- a/src/mongo/s/catalog/legacy/catalog_manager_legacy.h +++ b/src/mongo/s/catalog/legacy/catalog_manager_legacy.h @@ -28,13 +28,13 @@ #pragma once -#include <boost/thread/condition.hpp> #include <string> #include <vector> #include "mongo/bson/bsonobj.h" #include "mongo/client/connection_string.h" #include "mongo/s/catalog/catalog_manager.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/thread.h" namespace mongo { @@ -205,7 +205,7 @@ namespace mongo { // condition variable used by the consistency checker thread to wait // for <= 60s, on every iteration, until shutDown is called - boost::condition _consistencyCheckerCV; + stdx::condition_variable _consistencyCheckerCV; }; } // namespace mongo diff --git a/src/mongo/s/catalog/legacy/legacy_dist_lock_manager.h b/src/mongo/s/catalog/legacy/legacy_dist_lock_manager.h index 5e76df26626..50a6088c333 100644 --- a/src/mongo/s/catalog/legacy/legacy_dist_lock_manager.h +++ b/src/mongo/s/catalog/legacy/legacy_dist_lock_manager.h @@ -72,7 +72,7 @@ namespace mongo { const ConnectionString _configServer; stdx::mutex _mutex; - boost::condition_variable _noLocksCV; + stdx::condition_variable _noLocksCV; std::map<DistLockHandle, std::unique_ptr<DistributedLock>> _lockMap; std::unique_ptr<LegacyDistLockPinger> _pinger; diff --git a/src/mongo/s/catalog/legacy/legacy_dist_lock_pinger.h b/src/mongo/s/catalog/legacy/legacy_dist_lock_pinger.h index 261f695d8ae..d09606c9400 100644 --- a/src/mongo/s/catalog/legacy/legacy_dist_lock_pinger.h +++ b/src/mongo/s/catalog/legacy/legacy_dist_lock_pinger.h @@ -35,6 +35,7 @@ #include "mongo/base/status.h" #include "mongo/client/dbclientinterface.h" #include "mongo/s/catalog/dist_lock_manager.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/util/concurrency/mutex.h" @@ -116,7 +117,7 @@ namespace mongo { mongo::mutex _mutex; // Triggered everytime a pinger thread is stopped. - boost::condition_variable _pingStoppedCV; // (M) + stdx::condition_variable _pingStoppedCV; // (M) // pingID -> thread // This can contain multiple elements in tests, but in tne normal case, this will diff --git a/src/mongo/s/client/multi_host_query.h b/src/mongo/s/client/multi_host_query.h index bfd23953e25..7b69ecc25f5 100644 --- a/src/mongo/s/client/multi_host_query.h +++ b/src/mongo/s/client/multi_host_query.h @@ -28,11 +28,11 @@ #pragma once -#include <boost/thread/condition_variable.hpp> #include <vector> #include "mongo/base/disallow_copying.h" #include "mongo/client/dbclientinterface.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" @@ -178,7 +178,7 @@ namespace mongo { typedef std::map<ConnectionString, StatusWith<DBClientCursor*> > ResultMap; ResultMap _results; - boost::condition_variable _nextResultCV; + stdx::condition_variable _nextResultCV; }; /** @@ -302,11 +302,11 @@ namespace mongo { // The scheduled work std::deque<Callback> scheduled; - boost::condition_variable workScheduledCV; + stdx::condition_variable workScheduledCV; // How many workers are currently active int numActiveWorkers; - boost::condition_variable isIdleCV; + stdx::condition_variable isIdleCV; // Whether the pool has been disposed of bool isPoolActive; diff --git a/src/mongo/scripting/v8-3.25_utils.cpp b/src/mongo/scripting/v8-3.25_utils.cpp index a0b974c22a3..dd545351323 100644 --- a/src/mongo/scripting/v8-3.25_utils.cpp +++ b/src/mongo/scripting/v8-3.25_utils.cpp @@ -31,7 +31,6 @@ #include "mongo/scripting/v8-3.25_utils.h" -#include <boost/thread/condition_variable.hpp> #include <iostream> #include <map> #include <sstream> @@ -40,6 +39,7 @@ #include "mongo/platform/cstdint.h" #include "mongo/scripting/engine_v8-3.25.h" #include "mongo/scripting/v8-3.25_db.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/util/log.h" @@ -245,7 +245,7 @@ namespace mongo { private: struct Latch { Latch(int32_t count) : count(count) {} - boost::condition_variable cv; + stdx::condition_variable cv; stdx::mutex mutex; int32_t count; }; diff --git a/src/mongo/scripting/v8_deadline_monitor.h b/src/mongo/scripting/v8_deadline_monitor.h index 1ebc096fed8..362701c2762 100644 --- a/src/mongo/scripting/v8_deadline_monitor.h +++ b/src/mongo/scripting/v8_deadline_monitor.h @@ -27,11 +27,10 @@ */ #pragma once -#include <boost/thread/condition.hpp> - #include "mongo/base/disallow_copying.h" #include "mongo/platform/cstdint.h" #include "mongo/platform/unordered_map.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/thread.h" #include "mongo/util/concurrency/mutex.h" #include "mongo/util/time_support.h" @@ -161,7 +160,7 @@ namespace mongo { typedef unordered_map<_Task*, Date_t> TaskDeadlineMap; TaskDeadlineMap _tasks; // map of running tasks with deadlines stdx::mutex _deadlineMutex; // protects all non-const members, except _monitorThread - boost::condition_variable _newDeadlineAvailable; // Signaled for timeout, start and stop + stdx::condition_variable _newDeadlineAvailable; // Signaled for timeout, start and stop stdx::thread _monitorThread; // the deadline monitor thread Date_t _nearestDeadlineWallclock = Date_t::max(); // absolute time of the nearest deadline bool _inShutdown = false; diff --git a/src/mongo/scripting/v8_deadline_monitor_test.cpp b/src/mongo/scripting/v8_deadline_monitor_test.cpp index a76246d4031..e9424431911 100644 --- a/src/mongo/scripting/v8_deadline_monitor_test.cpp +++ b/src/mongo/scripting/v8_deadline_monitor_test.cpp @@ -57,7 +57,7 @@ namespace mongo { } private: mongo::mutex _m; - boost::condition _c; + stdx::condition_variable _c; uint64_t _killCount; uint64_t _targetKillCount; }; diff --git a/src/mongo/scripting/v8_utils.cpp b/src/mongo/scripting/v8_utils.cpp index 0dd6c087cd4..42c33c40f65 100644 --- a/src/mongo/scripting/v8_utils.cpp +++ b/src/mongo/scripting/v8_utils.cpp @@ -31,7 +31,6 @@ #include "mongo/scripting/v8_utils.h" -#include <boost/thread/condition_variable.hpp> #include <iostream> #include <map> #include <sstream> @@ -40,6 +39,7 @@ #include "mongo/platform/cstdint.h" #include "mongo/scripting/engine_v8.h" #include "mongo/scripting/v8_db.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/util/log.h" @@ -242,7 +242,7 @@ namespace mongo { private: struct Latch { Latch(int32_t count) : count(count) {} - boost::condition_variable cv; + stdx::condition_variable cv; stdx::mutex mutex; int32_t count; }; diff --git a/src/mongo/shell/bench.cpp b/src/mongo/shell/bench.cpp index 6fc881f350a..99311f23f62 100644 --- a/src/mongo/shell/bench.cpp +++ b/src/mongo/shell/bench.cpp @@ -245,18 +245,18 @@ namespace mongo { } void BenchRunState::waitForState(State awaitedState) { - stdx::lock_guard<stdx::mutex> lk(_mutex); + stdx::unique_lock<stdx::mutex> lk(_mutex); switch ( awaitedState ) { case BRS_RUNNING: while ( _numUnstartedWorkers > 0 ) { massert( 16147, "Already finished.", _numUnstartedWorkers + _numActiveWorkers > 0 ); - _stateChangeCondition.wait( _mutex ); + _stateChangeCondition.wait( lk ); } break; case BRS_FINISHED: while ( _numUnstartedWorkers + _numActiveWorkers > 0 ) { - _stateChangeCondition.wait( _mutex ); + _stateChangeCondition.wait( lk ); } break; default: diff --git a/src/mongo/shell/bench.h b/src/mongo/shell/bench.h index 2415b2366b7..a3ab7dc16ab 100644 --- a/src/mongo/shell/bench.h +++ b/src/mongo/shell/bench.h @@ -30,11 +30,10 @@ #include <string> -#include <boost/thread/condition.hpp> - #include "mongo/client/dbclientinterface.h" #include "mongo/db/jsobj.h" #include "mongo/platform/atomic_word.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/mutex.h" #include "mongo/util/timer.h" @@ -322,7 +321,7 @@ namespace mongo { private: stdx::mutex _mutex; - boost::condition _stateChangeCondition; + stdx::condition_variable _stateChangeCondition; unsigned _numUnstartedWorkers; unsigned _numActiveWorkers; AtomicUInt32 _isShuttingDown; diff --git a/src/mongo/stdx/condition_variable.h b/src/mongo/stdx/condition_variable.h index 5a494edf5b4..aa67b0c4be8 100644 --- a/src/mongo/stdx/condition_variable.h +++ b/src/mongo/stdx/condition_variable.h @@ -34,6 +34,7 @@ namespace mongo { namespace stdx { using condition_variable = boost::condition_variable; + using condition_variable_any = boost::condition_variable_any; using cv_status = boost::cv_status; } // namespace stdx diff --git a/src/mongo/util/concurrency/old_thread_pool.h b/src/mongo/util/concurrency/old_thread_pool.h index 963ce2ff4ac..9ece85425b7 100644 --- a/src/mongo/util/concurrency/old_thread_pool.h +++ b/src/mongo/util/concurrency/old_thread_pool.h @@ -30,9 +30,8 @@ #include <list> #include <string> -#include <boost/thread/condition.hpp> - #include "mongo/base/disallow_copying.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/functional.h" #include "mongo/stdx/mutex.h" @@ -87,7 +86,7 @@ namespace mongo { private: class Worker; stdx::mutex _mutex; - boost::condition _condition; + stdx::condition_variable _condition; std::list<Worker*> _freeWorkers; //used as LIFO stack (always front) std::list<Task> _tasks; //used as FIFO queue (push_back, pop_front) diff --git a/src/mongo/util/concurrency/rwlockimpl.cpp b/src/mongo/util/concurrency/rwlockimpl.cpp index 659275843b8..b8bcf50b530 100644 --- a/src/mongo/util/concurrency/rwlockimpl.cpp +++ b/src/mongo/util/concurrency/rwlockimpl.cpp @@ -37,9 +37,9 @@ #include <map> #include <set> #include <boost/version.hpp> -#include <boost/thread/condition.hpp> #include "mongo/config.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/mutex.h" #include "mongo/util/assert_util.h" #include "mongo/util/concurrency/rwlockimpl.h" diff --git a/src/mongo/util/concurrency/synchronization.h b/src/mongo/util/concurrency/synchronization.h index 2151aa28f53..e8c604ad244 100644 --- a/src/mongo/util/concurrency/synchronization.h +++ b/src/mongo/util/concurrency/synchronization.h @@ -29,9 +29,9 @@ #pragma once -#include <boost/thread/condition.hpp> +#include "mongo/stdx/condition_variable.h" -#include "mutex.h" +#include "mongo/util/concurrency/mutex.h" namespace mongo { @@ -81,7 +81,7 @@ namespace mongo { mongo::mutex _mutex; // protects state below unsigned long long lookFor; unsigned long long cur; - boost::condition _condition; // cond over _notified being true + stdx::condition_variable _condition; // cond over _notified being true }; /** establishes a synchronization point between threads. N threads are waits and one is notifier. @@ -112,7 +112,7 @@ namespace mongo { private: mongo::mutex _mutex; - boost::condition _condition; + stdx::condition_variable _condition; When _lastDone; When _lastReturned; unsigned _nWaiting; diff --git a/src/mongo/util/net/listen.h b/src/mongo/util/net/listen.h index 9d55c4da854..546ef223bf4 100644 --- a/src/mongo/util/net/listen.h +++ b/src/mongo/util/net/listen.h @@ -29,13 +29,13 @@ #pragma once -#include <boost/thread/condition_variable.hpp> #include <set> #include <string> #include <vector> #include "mongo/config.h" #include "mongo/platform/atomic_word.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/stdx/mutex.h" #include "mongo/util/concurrency/ticketholder.h" #include "mongo/util/net/sock.h" @@ -114,7 +114,7 @@ namespace mongo { bool _logConnect; long long _elapsedTime; mutable stdx::mutex _readyMutex; // Protects _ready - mutable boost::condition_variable _readyCondition; // Used to wait for changes to _ready + mutable stdx::condition_variable _readyCondition; // Used to wait for changes to _ready // Boolean that indicates whether this Listener is ready to accept incoming network requests bool _ready; |