diff options
author | Andy Schwerin <schwerin@mongodb.com> | 2014-05-15 19:28:57 -0400 |
---|---|---|
committer | Andy Schwerin <schwerin@mongodb.com> | 2014-05-16 16:01:50 -0400 |
commit | 995c04a16090511692c67a3555bdb61b5a387fa1 (patch) | |
tree | d60126db86cff5ca377152bb6a6c4e0439c9d932 /src/mongo/s | |
parent | 864d86ad02e3de2149b4f80949d66a03cff061d1 (diff) | |
download | mongo-995c04a16090511692c67a3555bdb61b5a387fa1.tar.gz |
SERVER-13882 Replace boost::function with stdx::function and boost::bind with stdx::bind.
Diffstat (limited to 'src/mongo/s')
-rw-r--r-- | src/mongo/s/config_upgrade.cpp | 5 | ||||
-rw-r--r-- | src/mongo/s/distlock.cpp | 2 | ||||
-rw-r--r-- | src/mongo/s/distlock_test.cpp | 2 | ||||
-rw-r--r-- | src/mongo/s/multi_host_query.cpp | 4 | ||||
-rw-r--r-- | src/mongo/s/multi_host_query.h | 6 | ||||
-rw-r--r-- | src/mongo/s/multi_host_query_test.cpp | 15 | ||||
-rw-r--r-- | src/mongo/s/server.cpp | 4 | ||||
-rw-r--r-- | src/mongo/s/shard.cpp | 4 |
8 files changed, 24 insertions, 18 deletions
diff --git a/src/mongo/s/config_upgrade.cpp b/src/mongo/s/config_upgrade.cpp index a26ae7c42e3..e9ef27af369 100644 --- a/src/mongo/s/config_upgrade.cpp +++ b/src/mongo/s/config_upgrade.cpp @@ -28,8 +28,6 @@ #include "mongo/s/config_upgrade.h" -#include <boost/function.hpp> - #include "mongo/base/init.h" #include "mongo/client/dbclientcursor.h" #include "mongo/s/cluster_client_internal.h" @@ -39,6 +37,7 @@ #include "mongo/s/type_database.h" #include "mongo/s/type_settings.h" #include "mongo/s/type_shard.h" +#include "mongo/stdx/functional.h" #include "mongo/util/assert_util.h" #include "mongo/util/version.h" @@ -75,7 +74,7 @@ namespace mongo { */ struct Upgrade { - typedef boost::function<bool(const ConnectionString&, const VersionType&, string*)> UpgradeCallback; + typedef stdx::function<bool(const ConnectionString&, const VersionType&, string*)> UpgradeCallback; Upgrade(int _fromVersion, const VersionRange& _toVersionRange, diff --git a/src/mongo/s/distlock.cpp b/src/mongo/s/distlock.cpp index 47461f66d0b..3e9d62fe6e3 100644 --- a/src/mongo/s/distlock.cpp +++ b/src/mongo/s/distlock.cpp @@ -300,7 +300,7 @@ namespace mongo { throw LockException( str::stream() << "error checking clock skew of cluster " << conn.toString() << causedBy( e ) , 13651); } - boost::thread t( boost::bind( &DistributedLockPinger::distLockPingThread, this, conn, getJSTimeVirtualThreadSkew(), processId, sleepTime) ); + boost::thread t( stdx::bind( &DistributedLockPinger::distLockPingThread, this, conn, getJSTimeVirtualThreadSkew(), processId, sleepTime) ); _seen.insert( s ); diff --git a/src/mongo/s/distlock_test.cpp b/src/mongo/s/distlock_test.cpp index be2798cc8f6..c27259f655c 100644 --- a/src/mongo/s/distlock_test.cpp +++ b/src/mongo/s/distlock_test.cpp @@ -367,7 +367,7 @@ namespace mongo { for (int i = 0; i < numThreads; i++) { results.push_back(shared_ptr<BSONObjBuilder> (new BSONObjBuilder())); threads.push_back(shared_ptr<boost::thread> (new boost::thread( - boost::bind(&TestDistLockWithSkew::runThread, this, + stdx::bind(&TestDistLockWithSkew::runThread, this, hostConn, (unsigned) i, seed + i, boost::ref(cmdObj), boost::ref(*(results[i].get())))))); } diff --git a/src/mongo/s/multi_host_query.cpp b/src/mongo/s/multi_host_query.cpp index 5566177df98..2853e6a40e0 100644 --- a/src/mongo/s/multi_host_query.cpp +++ b/src/mongo/s/multi_host_query.cpp @@ -51,7 +51,7 @@ namespace mongo { // dispatching pool has already been disposed. // - _threads.push_back(new boost::thread(boost::bind(&HostThreadPool::doWork, _context))); + _threads.push_back(new boost::thread(stdx::bind(&HostThreadPool::doWork, _context))); } } @@ -204,7 +204,7 @@ namespace mongo { _pending.insert(make_pair(host, pendingOp)); HostThreadPool::Callback callback = - boost::bind(&MultiHostQueryOp::PendingQueryContext::doBlockingQuery, pendingOp); + stdx::bind(&MultiHostQueryOp::PendingQueryContext::doBlockingQuery, pendingOp); _hostThreads->schedule(host, callback); } diff --git a/src/mongo/s/multi_host_query.h b/src/mongo/s/multi_host_query.h index 702764848fd..bfdf5d8c766 100644 --- a/src/mongo/s/multi_host_query.h +++ b/src/mongo/s/multi_host_query.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/function.hpp> #include <boost/smart_ptr/shared_ptr.hpp> #include <boost/thread/condition_variable.hpp> #include <boost/thread/mutex.hpp> @@ -38,6 +37,7 @@ #include "mongo/base/disallow_copying.h" #include "mongo/base/owned_pointer_vector.h" #include "mongo/client/dbclientinterface.h" +#include "mongo/stdx/functional.h" namespace mongo { @@ -221,7 +221,7 @@ namespace mongo { MONGO_DISALLOW_COPYING(HostThreadPools); public: - typedef boost::function<void(void)> Callback; + typedef stdx::function<void(void)> Callback; /** * Construct a HostThreadPools object, which lazily constructs thread pools per-host of the @@ -263,7 +263,7 @@ namespace mongo { class HostThreadPool { public: - typedef boost::function<void(void)> Callback; + typedef stdx::function<void(void)> Callback; /** * Constructs a thread pool of a given size. diff --git a/src/mongo/s/multi_host_query_test.cpp b/src/mongo/s/multi_host_query_test.cpp index 467668266f2..7dd1628c727 100644 --- a/src/mongo/s/multi_host_query_test.cpp +++ b/src/mongo/s/multi_host_query_test.cpp @@ -58,11 +58,11 @@ namespace { } HostThreadPool::Callback getCallback() { - return boost::bind(&CallbackCheck::noteCallback, this); + return stdx::bind(&CallbackCheck::noteCallback, this); } HostThreadPool::Callback getHostCallback(const ConnectionString& host) { - return boost::bind(&CallbackCheck::noteHostCallback, this, host); + return stdx::bind(&CallbackCheck::noteHostCallback, this, host); } void noteHostCallback(const ConnectionString& host) { @@ -232,7 +232,7 @@ namespace { // The query won't be scheduled by the multi op, so we need to do so ourselves _threadPool->schedule(host, - boost::bind(&MockSystemEnv::doBlockingQuery, + stdx::bind(&MockSystemEnv::doBlockingQuerySwallowResult, this, host, QuerySpec())); @@ -241,7 +241,14 @@ namespace { Date_t currentTimeMillis() { return _mockTimeMillis; } - + + void doBlockingQuerySwallowResult(const ConnectionString& host, + const QuerySpec& query) { + StatusWith<DBClientCursor*> result = doBlockingQuery(host, query); + if (result.isOK()) + delete result.getValue(); + } + StatusWith<DBClientCursor*> doBlockingQuery(const ConnectionString& host, const QuerySpec& query) { diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp index ca4106a58f9..291f627ccba 100644 --- a/src/mongo/s/server.cpp +++ b/src/mongo/s/server.cpp @@ -219,7 +219,7 @@ static bool runMongosServer( bool doUpgrade ) { DBClientConnection::setLazyKillCursor( false ); ReplicaSetMonitor::setConfigChangeHook( - boost::bind(&ConfigServer::replicaSetChange, &configServer, _1 , _2)); + stdx::bind(&ConfigServer::replicaSetChange, &configServer, stdx::placeholders::_1 , stdx::placeholders::_2)); if (!configServer.init(mongosGlobalParams.configdbs)) { log() << "couldn't resolve config db address" << endl; @@ -268,7 +268,7 @@ static bool runMongosServer( bool doUpgrade ) { #endif if (serverGlobalParams.isHttpInterfaceEnabled) - boost::thread web( boost::bind(&webServerThread, + boost::thread web( stdx::bind(&webServerThread, new NoAdminAccess(), // takes ownership OperationContext::factoryNULL) ); // XXX SERVER-13931 diff --git a/src/mongo/s/shard.cpp b/src/mongo/s/shard.cpp index e8dc03b0557..9daf1780583 100644 --- a/src/mongo/s/shard.cpp +++ b/src/mongo/s/shard.cpp @@ -491,13 +491,13 @@ namespace mongo { // For every DBClient created by mongos, add a hook that will capture the response from // commands, so that we can target the correct node when subsequent getLastError calls // are made by mongos. - conn->setPostRunCommandHook(boost::bind(&saveGLEStats, _1, _2)); + conn->setPostRunCommandHook(stdx::bind(&saveGLEStats, stdx::placeholders::_1, stdx::placeholders::_2)); } // For every DBClient created by mongos, add a hook that will append impersonated users // to the end of every runCommand. mongod uses this information to produce auditing // records attributed to the proper authenticated user(s). - conn->setRunCommandHook(boost::bind(&audit::appendImpersonatedUsers, _1)); + conn->setRunCommandHook(stdx::bind(&audit::appendImpersonatedUsers, stdx::placeholders::_1)); // For every SCC created, add a hook that will allow fastest-config-first config reads if // the appropriate server options are set. |