diff options
63 files changed, 239 insertions, 213 deletions
diff --git a/src/mongo/base/initializer_function.h b/src/mongo/base/initializer_function.h index bc8466d15e2..c0ab4de3577 100644 --- a/src/mongo/base/initializer_function.h +++ b/src/mongo/base/initializer_function.h @@ -27,9 +27,8 @@ #pragma once -#include <boost/function.hpp> - #include "mongo/base/status.h" +#include "mongo/stdx/functional.h" namespace mongo { @@ -41,6 +40,6 @@ namespace mongo { * On successful execution, an InitializerFunction returns Status::OK(). It may * inspect and mutate the supplied InitializerContext. */ - typedef boost::function<Status (InitializerContext*)> InitializerFunction; + typedef stdx::function<Status (InitializerContext*)> InitializerFunction; } // namespace mongo diff --git a/src/mongo/client/dbclient.cpp b/src/mongo/client/dbclient.cpp index 3341f5d440f..407665ed735 100644 --- a/src/mongo/client/dbclient.cpp +++ b/src/mongo/client/dbclient.cpp @@ -1053,18 +1053,18 @@ namespace mongo { _f( i.nextSafe() ); } } - boost::function<void(const BSONObj &)> _f; + stdx::function<void(const BSONObj &)> _f; }; - unsigned long long DBClientBase::query( boost::function<void(const BSONObj&)> f, const string& ns, Query query, const BSONObj *fieldsToReturn, int queryOptions ) { + unsigned long long DBClientBase::query( stdx::function<void(const BSONObj&)> f, const string& ns, Query query, const BSONObj *fieldsToReturn, int queryOptions ) { DBClientFunConvertor fun; fun._f = f; - boost::function<void(DBClientCursorBatchIterator &)> ptr( fun ); + stdx::function<void(DBClientCursorBatchIterator &)> ptr( fun ); return this->query( ptr, ns, query, fieldsToReturn, queryOptions ); } unsigned long long DBClientBase::query( - boost::function<void(DBClientCursorBatchIterator &)> f, + stdx::function<void(DBClientCursorBatchIterator &)> f, const string& ns, Query query, const BSONObj *fieldsToReturn, @@ -1091,7 +1091,7 @@ namespace mongo { } unsigned long long DBClientConnection::query( - boost::function<void(DBClientCursorBatchIterator &)> f, + stdx::function<void(DBClientCursorBatchIterator &)> f, const string& ns, Query query, const BSONObj *fieldsToReturn, diff --git a/src/mongo/client/dbclientinterface.h b/src/mongo/client/dbclientinterface.h index 8fe0e7a55af..49d620fe980 100644 --- a/src/mongo/client/dbclientinterface.h +++ b/src/mongo/client/dbclientinterface.h @@ -34,13 +34,12 @@ #include "mongo/pch.h" -#include <boost/function.hpp> - #include "mongo/base/string_data.h" #include "mongo/client/export_macros.h" #include "mongo/db/jsobj.h" #include "mongo/logger/log_severity.h" #include "mongo/platform/atomic_word.h" +#include "mongo/stdx/functional.h" #include "mongo/util/net/message.h" #include "mongo/util/net/message_port.h" @@ -86,7 +85,7 @@ namespace mongo { will fully read all data queried. Faster when you are pulling a lot of data and know you want to pull it all down. Note: it is not allowed to not read all the data unless you close the connection. - Use the query( boost::function<void(const BSONObj&)> f, ... ) version of the connection's query() + Use the query( stdx::function<void(const BSONObj&)> f, ... ) version of the connection's query() method, and it will take care of all the details for you. */ QueryOption_Exhaust = 1 << 6, @@ -996,7 +995,7 @@ namespace mongo { * Once such a function is set as the runCommand hook, every time the DBClient * processes a runCommand, the hook will be called just prior to sending it to the server. */ - typedef boost::function<void(BSONObjBuilder*)> RunCommandHookFunc; + typedef stdx::function<void(BSONObjBuilder*)> RunCommandHookFunc; virtual void setRunCommandHook(RunCommandHookFunc func); RunCommandHookFunc getRunCommandHook() const { return _runCommandHook; @@ -1006,7 +1005,7 @@ namespace mongo { * Similar to above, but for running a function on a command response after a command * has been run. */ - typedef boost::function<void(const BSONObj&, const std::string&)> PostRunCommandHookFunc; + typedef stdx::function<void(const BSONObj&, const std::string&)> PostRunCommandHookFunc; virtual void setPostRunCommandHook(PostRunCommandHookFunc func); PostRunCommandHookFunc getPostRunCommandHook() const { return _postRunCommandHook; @@ -1122,13 +1121,13 @@ namespace mongo { Use the DBClientCursorBatchIterator version, below, if you want to do items in large blocks, perhaps to avoid granular locking and such. */ - virtual unsigned long long query( boost::function<void(const BSONObj&)> f, + virtual unsigned long long query( stdx::function<void(const BSONObj&)> f, const string& ns, Query query, const BSONObj *fieldsToReturn = 0, int queryOptions = 0 ); - virtual unsigned long long query( boost::function<void(DBClientCursorBatchIterator&)> f, + virtual unsigned long long query( stdx::function<void(DBClientCursorBatchIterator&)> f, const string& ns, Query query, const BSONObj *fieldsToReturn = 0, @@ -1279,7 +1278,7 @@ namespace mongo { return DBClientBase::query( ns, query, nToReturn, nToSkip, fieldsToReturn, queryOptions , batchSize ); } - virtual unsigned long long query( boost::function<void(DBClientCursorBatchIterator &)> f, + virtual unsigned long long query( stdx::function<void(DBClientCursorBatchIterator &)> f, const string& ns, Query query, const BSONObj *fieldsToReturn, diff --git a/src/mongo/client/replica_set_monitor.h b/src/mongo/client/replica_set_monitor.h index a0894133eeb..5641607ef52 100644 --- a/src/mongo/client/replica_set_monitor.h +++ b/src/mongo/client/replica_set_monitor.h @@ -27,13 +27,13 @@ #pragma once -#include <boost/function.hpp> #include <boost/shared_ptr.hpp> #include <string> #include <set> #include "mongo/base/disallow_copying.h" #include "mongo/base/string_data.h" +#include "mongo/stdx/functional.h" #include "mongo/util/net/hostandport.h" namespace mongo { @@ -51,7 +51,7 @@ namespace mongo { public: class Refresher; - typedef boost::function<void(const std::string& setName, + typedef stdx::function<void(const std::string& setName, const std::string& newConnectionString)> ConfigChangeHook; diff --git a/src/mongo/db/auth/authorization_manager.cpp b/src/mongo/db/auth/authorization_manager.cpp index 1ca100e449e..3f6e3f620b5 100644 --- a/src/mongo/db/auth/authorization_manager.cpp +++ b/src/mongo/db/auth/authorization_manager.cpp @@ -393,7 +393,7 @@ namespace mongo { const NamespaceString& collectionName, const BSONObj& query, const BSONObj& projection, - const boost::function<void(const BSONObj&)>& resultProcessor) { + const stdx::function<void(const BSONObj&)>& resultProcessor) { return _externalState->query(collectionName, query, projection, resultProcessor); } @@ -1051,7 +1051,7 @@ namespace { NamespaceString(db, "system.users"), BSONObj(), BSONObj(), - boost::bind(upgradeProcessUser, externalState, db, _1, writeConcern)); + stdx::bind(upgradeProcessUser, externalState, db, stdx::placeholders::_1, writeConcern)); } /** @@ -1078,10 +1078,10 @@ namespace { sourceCollection, BSONObj(), BSONObj(), - boost::bind(uassertInsertIntoCollection, + stdx::bind(uassertInsertIntoCollection, externalState, targetCollection, - _1, + stdx::placeholders::_1, writeConcern)); } diff --git a/src/mongo/db/auth/authorization_manager.h b/src/mongo/db/auth/authorization_manager.h index 8782ae06d5c..bd32cba4224 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/function.hpp> #include <boost/scoped_ptr.hpp> #include <boost/thread/condition_variable.hpp> #include <boost/thread/mutex.hpp> @@ -48,6 +47,7 @@ #include "mongo/db/jsobj.h" #include "mongo/db/namespace_string.h" #include "mongo/platform/unordered_map.h" +#include "mongo/stdx/functional.h" namespace mongo { @@ -258,7 +258,7 @@ namespace mongo { Status queryAuthzDocument(const NamespaceString& collectionName, const BSONObj& query, const BSONObj& projection, - const boost::function<void(const BSONObj&)>& resultProcessor); + const stdx::function<void(const BSONObj&)>& resultProcessor); // Checks to see if "doc" is a valid privilege document, assuming it is stored in the // "system.users" collection of database "dbname". diff --git a/src/mongo/db/auth/authz_manager_external_state.h b/src/mongo/db/auth/authz_manager_external_state.h index 8656847036d..683de53b108 100644 --- a/src/mongo/db/auth/authz_manager_external_state.h +++ b/src/mongo/db/auth/authz_manager_external_state.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/function.hpp> #include <string> #include <vector> @@ -38,6 +37,7 @@ #include "mongo/db/auth/user_name.h" #include "mongo/db/jsobj.h" #include "mongo/db/namespace_string.h" +#include "mongo/stdx/functional.h" namespace mongo { @@ -175,7 +175,7 @@ namespace mongo { virtual Status query(const NamespaceString& collectionName, const BSONObj& query, const BSONObj& projection, - const boost::function<void(const BSONObj&)>& resultProcessor) = 0; + const stdx::function<void(const BSONObj&)>& resultProcessor) = 0; /** * Inserts "document" into "collectionName". diff --git a/src/mongo/db/auth/authz_manager_external_state_d.cpp b/src/mongo/db/auth/authz_manager_external_state_d.cpp index 388644f9bdc..2c009314f48 100644 --- a/src/mongo/db/auth/authz_manager_external_state_d.cpp +++ b/src/mongo/db/auth/authz_manager_external_state_d.cpp @@ -84,7 +84,7 @@ namespace mongo { const NamespaceString& collectionName, const BSONObj& query, const BSONObj& projection, - const boost::function<void(const BSONObj&)>& resultProcessor) { + const stdx::function<void(const BSONObj&)>& resultProcessor) { try { DBDirectClient client; client.query(resultProcessor, collectionName.ns(), query, &projection); diff --git a/src/mongo/db/auth/authz_manager_external_state_d.h b/src/mongo/db/auth/authz_manager_external_state_d.h index df7d26c1ec8..380d4eb6bef 100644 --- a/src/mongo/db/auth/authz_manager_external_state_d.h +++ b/src/mongo/db/auth/authz_manager_external_state_d.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/function.hpp> #include <boost/thread/mutex.hpp> #include <string> @@ -37,6 +36,7 @@ #include "mongo/db/auth/authz_manager_external_state_local.h" #include "mongo/db/auth/role_graph.h" #include "mongo/db/auth/user_name.h" +#include "mongo/stdx/functional.h" namespace mongo { @@ -58,7 +58,7 @@ namespace mongo { virtual Status query(const NamespaceString& collectionName, const BSONObj& query, const BSONObj& projection, - const boost::function<void(const BSONObj&)>& resultProcessor); + const stdx::function<void(const BSONObj&)>& resultProcessor); virtual Status insert(const NamespaceString& collectionName, const BSONObj& document, const BSONObj& writeConcern); diff --git a/src/mongo/db/auth/authz_manager_external_state_local.cpp b/src/mongo/db/auth/authz_manager_external_state_local.cpp index ce9f095c1c1..099e5638020 100644 --- a/src/mongo/db/auth/authz_manager_external_state_local.cpp +++ b/src/mongo/db/auth/authz_manager_external_state_local.cpp @@ -318,7 +318,7 @@ namespace { AuthorizationManager::rolesCollectionNamespace, BSONObj(), BSONObj(), - boost::bind(addRoleFromDocumentOrWarn, &newRoleGraph, _1)); + stdx::bind(addRoleFromDocumentOrWarn, &newRoleGraph, stdx::placeholders::_1)); if (!status.isOK()) return status; diff --git a/src/mongo/db/auth/authz_manager_external_state_local.h b/src/mongo/db/auth/authz_manager_external_state_local.h index f9c02dbd2ce..930172c6c1b 100644 --- a/src/mongo/db/auth/authz_manager_external_state_local.h +++ b/src/mongo/db/auth/authz_manager_external_state_local.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/function.hpp> #include <boost/thread/mutex.hpp> #include <string> @@ -38,6 +37,7 @@ #include "mongo/db/auth/role_graph.h" #include "mongo/db/auth/role_name.h" #include "mongo/db/auth/user_name.h" +#include "mongo/stdx/functional.h" namespace mongo { diff --git a/src/mongo/db/auth/authz_manager_external_state_mock.cpp b/src/mongo/db/auth/authz_manager_external_state_mock.cpp index b0b6773f0dc..5ee19c863a5 100644 --- a/src/mongo/db/auth/authz_manager_external_state_mock.cpp +++ b/src/mongo/db/auth/authz_manager_external_state_mock.cpp @@ -166,7 +166,7 @@ namespace { const NamespaceString& collectionName, const BSONObj& query, const BSONObj&, - const boost::function<void(const BSONObj&)>& resultProcessor) { + const stdx::function<void(const BSONObj&)>& resultProcessor) { std::vector<BSONObjCollection::iterator> iterVector; Status status = _queryVector(collectionName, query, &iterVector); if (!status.isOK()) { diff --git a/src/mongo/db/auth/authz_manager_external_state_mock.h b/src/mongo/db/auth/authz_manager_external_state_mock.h index 886157e0efe..6ec06f97692 100644 --- a/src/mongo/db/auth/authz_manager_external_state_mock.h +++ b/src/mongo/db/auth/authz_manager_external_state_mock.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/function.hpp> #include <string> #include <map> #include <vector> @@ -39,6 +38,7 @@ #include "mongo/db/auth/role_graph.h" #include "mongo/db/jsobj.h" #include "mongo/db/namespace_string.h" +#include "mongo/stdx/functional.h" namespace mongo { @@ -67,7 +67,7 @@ namespace mongo { virtual Status query(const NamespaceString& collectionName, const BSONObj& query, const BSONObj& projection, // Currently unused in mock - const boost::function<void(const BSONObj&)>& resultProcessor); + const stdx::function<void(const BSONObj&)>& resultProcessor); // This implementation does not understand uniqueness constraints. virtual Status insert(const NamespaceString& collectionName, diff --git a/src/mongo/db/auth/authz_manager_external_state_s.cpp b/src/mongo/db/auth/authz_manager_external_state_s.cpp index a49d3f6decb..8f1dd6d1256 100644 --- a/src/mongo/db/auth/authz_manager_external_state_s.cpp +++ b/src/mongo/db/auth/authz_manager_external_state_s.cpp @@ -213,7 +213,7 @@ namespace mongo { const NamespaceString& collectionName, const BSONObj& queryDoc, const BSONObj& projection, - const boost::function<void(const BSONObj&)>& resultProcessor) { + const stdx::function<void(const BSONObj&)>& resultProcessor) { try { scoped_ptr<ScopedDbConnection> conn(getConnectionForAuthzCollection(collectionName)); Query query(queryDoc); diff --git a/src/mongo/db/auth/authz_manager_external_state_s.h b/src/mongo/db/auth/authz_manager_external_state_s.h index 76c49bdac78..79e39611722 100644 --- a/src/mongo/db/auth/authz_manager_external_state_s.h +++ b/src/mongo/db/auth/authz_manager_external_state_s.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/function.hpp> #include <boost/thread/mutex.hpp> #include <boost/scoped_ptr.hpp> #include <string> @@ -38,6 +37,7 @@ #include "mongo/db/auth/authz_manager_external_state.h" #include "mongo/db/auth/user_name.h" #include "mongo/s/distlock.h" +#include "mongo/stdx/functional.h" namespace mongo { @@ -83,7 +83,7 @@ namespace mongo { virtual Status query(const NamespaceString& collectionName, const BSONObj& query, const BSONObj& projection, - const boost::function<void(const BSONObj&)>& resultProcessor); + const stdx::function<void(const BSONObj&)>& resultProcessor); virtual Status insert(const NamespaceString& collectionName, const BSONObj& document, diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp index 14df7c2f961..81ba24678c1 100644 --- a/src/mongo/db/cloner.cpp +++ b/src/mongo/db/cloner.cpp @@ -222,7 +222,7 @@ namespace mongo { int options = QueryOption_NoCursorTimeout | ( slaveOk ? QueryOption_SlaveOk : 0 ); { dbtemprelease r; - _conn->query(boost::function<void(DBClientCursorBatchIterator &)>(f), from_collection, + _conn->query(stdx::function<void(DBClientCursorBatchIterator &)>(f), from_collection, query, 0, options); } diff --git a/src/mongo/db/commands/user_management_commands.cpp b/src/mongo/db/commands/user_management_commands.cpp index 4d9aa3b943e..40999d0cbe5 100644 --- a/src/mongo/db/commands/user_management_commands.cpp +++ b/src/mongo/db/commands/user_management_commands.cpp @@ -30,8 +30,6 @@ #include "mongo/db/commands/user_management_commands.h" -#include <boost/bind.hpp> -#include <boost/function.hpp> #include <string> #include <vector> @@ -56,6 +54,7 @@ #include "mongo/db/commands.h" #include "mongo/db/jsobj.h" #include "mongo/platform/unordered_set.h" +#include "mongo/stdx/functional.h" #include "mongo/util/mongoutils/str.h" #include "mongo/util/net/ssl_manager.h" #include "mongo/util/sequence_util.h" @@ -302,6 +301,10 @@ namespace mongo { return Status::OK(); } + static void appendBSONObjToBSONArrayBuilder(BSONArrayBuilder* array, const BSONObj& obj) { + array->append(obj); + } + class CmdCreateUser : public Command { public: @@ -1116,10 +1119,10 @@ namespace mongo { if (!args.showCredentials) { projection.append("credentials", 0); } - BSONArrayBuilder& (BSONArrayBuilder::* appendBSONObj) (const BSONObj&) = - &BSONArrayBuilder::append<BSONObj>; - const boost::function<void(const BSONObj&)> function = - boost::bind(appendBSONObj, &usersArrayBuilder, _1); + const stdx::function<void(const BSONObj&)> function = stdx::bind( + appendBSONObjToBSONArrayBuilder, + &usersArrayBuilder, + stdx::placeholders::_1); authzManager->queryAuthzDocument(usersNamespace, queryBuilder.done(), projection.done(), @@ -2504,7 +2507,7 @@ namespace mongo { /** * Extracts the UserName from the user document and adds it to set of existing users. - * This function is written so it can used with boost::bind over the result set of a query + * This function is written so it can used with stdx::bind over the result set of a query * on admin.system.users to add the user names of all existing users to the "usersToDrop" * set used in the command body. */ @@ -2531,7 +2534,7 @@ namespace mongo { /** * Extracts the RoleName from the role document and adds it to set of existing roles. - * This function is written so it can used with boost::bind over the result set of a query + * This function is written so it can used with stdx::bind over the result set of a query * on admin.system.roles to add the role names of all existing roles to the "rolesToDrop" * set used in the command body. */ @@ -2591,7 +2594,7 @@ namespace mongo { } /** - * Designed to be used with boost::bind to be called on every user object in the result + * Designed to be used with stdx::bind to be called on every user object in the result * set of a query over the tempUsersCollection provided to the command. For each user * in the temp collection, adds that user to the actual admin.system.users collection. * Also removes any users it encounters from the usersToDrop set. @@ -2628,7 +2631,7 @@ namespace mongo { } /** - * Designed to be used with boost::bind to be called on every role object in the result + * Designed to be used with stdx::bind to be called on every role object in the result * set of a query over the tempRolesCollection provided to the command. For each role * in the temp collection, adds that role to the actual admin.system.roles collection. * Also removes any roles it encounters from the rolesToDrop set. @@ -2690,9 +2693,9 @@ namespace mongo { AuthorizationManager::usersCollectionNamespace, BSONObj(), fields, - boost::bind(&CmdMergeAuthzCollections::extractAndInsertUserName, + stdx::bind(&CmdMergeAuthzCollections::extractAndInsertUserName, &usersToDrop, - _1)); + stdx::placeholders::_1)); if (!status.isOK()) { return status; } @@ -2702,12 +2705,12 @@ namespace mongo { NamespaceString(usersCollName), BSONObj(), BSONObj(), - boost::bind(&CmdMergeAuthzCollections::addUser, + stdx::bind(&CmdMergeAuthzCollections::addUser, authzManager, drop, writeConcern, &usersToDrop, - _1)); + stdx::placeholders::_1)); if (!status.isOK()) { return status; } @@ -2763,9 +2766,9 @@ namespace mongo { AuthorizationManager::rolesCollectionNamespace, BSONObj(), fields, - boost::bind(&CmdMergeAuthzCollections::extractAndInsertRoleName, + stdx::bind(&CmdMergeAuthzCollections::extractAndInsertRoleName, &rolesToDrop, - _1)); + stdx::placeholders::_1)); if (!status.isOK()) { return status; } @@ -2775,12 +2778,12 @@ namespace mongo { NamespaceString(rolesCollName), BSONObj(), BSONObj(), - boost::bind(&CmdMergeAuthzCollections::addRole, + stdx::bind(&CmdMergeAuthzCollections::addRole, authzManager, drop, writeConcern, &rolesToDrop, - _1)); + stdx::placeholders::_1)); if (!status.isOK()) { return status; } diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp index 93f174b2bb5..245d02d2c02 100644 --- a/src/mongo/db/db.cpp +++ b/src/mongo/db/db.cpp @@ -280,7 +280,7 @@ namespace mongo { logStartup(); startReplication(); if (serverGlobalParams.isHttpInterfaceEnabled) - boost::thread web( boost::bind(&webServerThread, + boost::thread web( stdx::bind(&webServerThread, new RestAdminAccess(), // takes ownership OperationContextImpl::factory) ); // XXX SERVER-13931 diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp index a2fbdf8eaa1..ab0a7ca7531 100644 --- a/src/mongo/db/instance.cpp +++ b/src/mongo/db/instance.cpp @@ -1053,7 +1053,7 @@ namespace { /* must do this before unmapping mem or you may get a seg fault */ log() << "shutdown: going to close sockets..." << endl; - boost::thread close_socket_thread( boost::bind(MessagingPort::closeAllSockets, 0) ); + boost::thread close_socket_thread( stdx::bind(MessagingPort::closeAllSockets, 0) ); // wait until file preallocation finishes // we would only hang here if the file_allocator code generates a diff --git a/src/mongo/db/matcher/expression_parser.h b/src/mongo/db/matcher/expression_parser.h index ae2c2a991ac..b463d84f64a 100644 --- a/src/mongo/db/matcher/expression_parser.h +++ b/src/mongo/db/matcher/expression_parser.h @@ -30,13 +30,12 @@ #pragma once -#include <boost/function.hpp> - #include "mongo/base/status.h" #include "mongo/base/status_with.h" #include "mongo/db/matcher/expression.h" #include "mongo/db/matcher/expression_leaf.h" #include "mongo/db/matcher/expression_tree.h" +#include "mongo/stdx/functional.h" namespace mongo { @@ -194,10 +193,10 @@ namespace mongo { }; - typedef boost::function<StatusWithMatchExpression(const char* name, int type, const BSONObj& section)> MatchExpressionParserGeoCallback; + typedef stdx::function<StatusWithMatchExpression(const char* name, int type, const BSONObj& section)> MatchExpressionParserGeoCallback; extern MatchExpressionParserGeoCallback expressionParserGeoCallback; - typedef boost::function<StatusWithMatchExpression(const BSONObj& queryObj)> MatchExpressionParserTextCallback; + typedef stdx::function<StatusWithMatchExpression(const BSONObj& queryObj)> MatchExpressionParserTextCallback; extern MatchExpressionParserTextCallback expressionParserTextCallback; } diff --git a/src/mongo/db/pipeline/expression.cpp b/src/mongo/db/pipeline/expression.cpp index 82d5c69cbea..12f700a290e 100644 --- a/src/mongo/db/pipeline/expression.cpp +++ b/src/mongo/db/pipeline/expression.cpp @@ -31,8 +31,6 @@ #include "db/pipeline/expression.h" #include <boost/algorithm/string.hpp> -#include <boost/bind.hpp> -#include <boost/function.hpp> #include <boost/preprocessor/cat.hpp> // like the ## operator but works with __LINE__ #include <cstdio> @@ -41,6 +39,7 @@ #include "mongo/db/pipeline/document.h" #include "mongo/db/pipeline/expression_context.h" #include "mongo/db/pipeline/value.h" +#include "mongo/stdx/functional.h" #include "mongo/util/string_map.h" #include "mongo/util/mongoutils/str.h" @@ -299,7 +298,7 @@ namespace mongo { } namespace { - typedef boost::function<intrusive_ptr<Expression>(BSONElement, const VariablesParseState&)> + typedef stdx::function<intrusive_ptr<Expression>(BSONElement, const VariablesParseState&)> ExpressionParser; StringMap<ExpressionParser> expressionParserMap; } @@ -609,19 +608,19 @@ namespace { /* ----------------------- ExpressionCompare --------------------------- */ REGISTER_EXPRESSION("$cmp", - boost::bind(ExpressionCompare::parse, _1, _2, ExpressionCompare::CMP)); + stdx::bind(ExpressionCompare::parse, stdx::placeholders::_1, stdx::placeholders::_2, ExpressionCompare::CMP)); REGISTER_EXPRESSION("$eq", - boost::bind(ExpressionCompare::parse, _1, _2, ExpressionCompare::EQ)); + stdx::bind(ExpressionCompare::parse, stdx::placeholders::_1, stdx::placeholders::_2, ExpressionCompare::EQ)); REGISTER_EXPRESSION("$gt", - boost::bind(ExpressionCompare::parse, _1, _2, ExpressionCompare::GT)); + stdx::bind(ExpressionCompare::parse, stdx::placeholders::_1, stdx::placeholders::_2, ExpressionCompare::GT)); REGISTER_EXPRESSION("$gte", - boost::bind(ExpressionCompare::parse, _1, _2, ExpressionCompare::GTE)); + stdx::bind(ExpressionCompare::parse, stdx::placeholders::_1, stdx::placeholders::_2, ExpressionCompare::GTE)); REGISTER_EXPRESSION("$lt", - boost::bind(ExpressionCompare::parse, _1, _2, ExpressionCompare::LT)); + stdx::bind(ExpressionCompare::parse, stdx::placeholders::_1, stdx::placeholders::_2, ExpressionCompare::LT)); REGISTER_EXPRESSION("$lte", - boost::bind(ExpressionCompare::parse, _1, _2, ExpressionCompare::LTE)); + stdx::bind(ExpressionCompare::parse, stdx::placeholders::_1, stdx::placeholders::_2, ExpressionCompare::LTE)); REGISTER_EXPRESSION("$ne", - boost::bind(ExpressionCompare::parse, _1, _2, ExpressionCompare::NE)); + stdx::bind(ExpressionCompare::parse, stdx::placeholders::_1, stdx::placeholders::_2, ExpressionCompare::NE)); intrusive_ptr<Expression> ExpressionCompare::parse( BSONElement bsonExpr, const VariablesParseState& vps, diff --git a/src/mongo/db/range_deleter.cpp b/src/mongo/db/range_deleter.cpp index 9ae7fdd2674..fd90b65c289 100644 --- a/src/mongo/db/range_deleter.cpp +++ b/src/mongo/db/range_deleter.cpp @@ -176,7 +176,7 @@ namespace mongo { void RangeDeleter::startWorkers() { if (!_worker) { - _worker.reset(new boost::thread(boost::bind(&RangeDeleter::doWork, this))); + _worker.reset(new boost::thread(stdx::bind(&RangeDeleter::doWork, this))); } } diff --git a/src/mongo/db/range_deleter_stat_test.cpp b/src/mongo/db/range_deleter_stat_test.cpp index 19d85b8a7f1..125bce8f139 100644 --- a/src/mongo/db/range_deleter_stat_test.cpp +++ b/src/mongo/db/range_deleter_stat_test.cpp @@ -26,7 +26,6 @@ * it in the license file. */ -#include <boost/bind.hpp> #include <boost/thread.hpp> #include <string> @@ -34,11 +33,11 @@ #include "mongo/db/range_deleter.h" #include "mongo/db/range_deleter_mock_env.h" #include "mongo/db/range_deleter_stats.h" +#include "mongo/stdx/functional.h" #include "mongo/unittest/unittest.h" namespace { - using boost::bind; using std::string; using mongo::BSONObj; @@ -52,6 +51,17 @@ namespace { OperationContext* const noTxn = NULL; // MockEnv doesn't need txn XXX SERVER-13931 + static void rangeDeleterDeleteNow(RangeDeleter* deleter, + OperationContext* txn, + const std::string& ns, + const BSONObj& min, + const BSONObj& max, + const BSONObj& shardKeyPattern, + bool secondaryThrottle, + std::string* errMsg) { + deleter->deleteNow(txn, ns, min, max, shardKeyPattern, secondaryThrottle, errMsg); + } + TEST(NoDeletes, InitialState) { RangeDeleterMockEnv* env = new RangeDeleterMockEnv(); RangeDeleter deleter(env); @@ -217,15 +227,15 @@ namespace { env->addCursorId(ns, 50); string errMsg; - boost::thread deleterThread = boost::thread(boost::bind(&RangeDeleter::deleteNow, - &deleter, - noTxn, - ns, - BSON("x" << 0), - BSON("x" << 10), - BSON("x" << 1), - true, - &errMsg)); + boost::thread deleterThread = boost::thread(mongo::stdx::bind(rangeDeleterDeleteNow, + &deleter, + noTxn, + ns, + BSON("x" << 0), + BSON("x" << 10), + BSON("x" << 1), + true, + &errMsg)); env->waitForNthGetCursor(1u); const BSONObj stats(deleter.getStats()->toBSON()); @@ -261,15 +271,15 @@ namespace { env->pauseDeletes(); string errMsg; - boost::thread deleterThread = boost::thread(boost::bind(&RangeDeleter::deleteNow, - &deleter, - noTxn, - ns, - BSON("x" << 0), - BSON("x" << 10), - BSON("x" << 1), - true, - &errMsg)); + boost::thread deleterThread = boost::thread(mongo::stdx::bind(rangeDeleterDeleteNow, + &deleter, + noTxn, + ns, + BSON("x" << 0), + BSON("x" << 10), + BSON("x" << 1), + true, + &errMsg)); env->waitForNthPausedDelete(1u); diff --git a/src/mongo/db/range_deleter_test.cpp b/src/mongo/db/range_deleter_test.cpp index 5ae950a606b..10c0b16acec 100644 --- a/src/mongo/db/range_deleter_test.cpp +++ b/src/mongo/db/range_deleter_test.cpp @@ -26,7 +26,6 @@ * it in the license file. */ -#include <boost/bind.hpp> #include <boost/thread.hpp> #include <string> @@ -34,11 +33,11 @@ #include "mongo/db/range_deleter.h" #include "mongo/db/range_deleter_mock_env.h" #include "mongo/db/range_deleter_stats.h" +#include "mongo/stdx/functional.h" #include "mongo/unittest/unittest.h" namespace { - using boost::bind; using std::string; using mongo::BSONObj; @@ -138,6 +137,17 @@ namespace { ASSERT_FALSE(env->deleteOccured()); } + static void rangeDeleterDeleteNow(RangeDeleter* deleter, + OperationContext* txn, + const std::string& ns, + const BSONObj& min, + const BSONObj& max, + const BSONObj& shardKeyPattern, + bool secondaryThrottle, + std::string* errMsg) { + deleter->deleteNow(txn, ns, min, max, shardKeyPattern, secondaryThrottle, errMsg); + } + // Should not start delete if the set of cursors that were open when the // deleteNow method is called is still open. TEST(ImmediateDelete, ShouldWaitCursor) { @@ -149,15 +159,16 @@ namespace { env->addCursorId(ns, 345); string errMsg; - boost::thread deleterThread = boost::thread(boost::bind(&RangeDeleter::deleteNow, - &deleter, - noTxn, - ns, - BSON("x" << 0), - BSON("x" << 10), - BSON("x" << 1), - true, - &errMsg)); + boost::thread deleterThread = boost::thread(mongo::stdx::bind( + rangeDeleterDeleteNow, + &deleter, + noTxn, + ns, + BSON("x" << 0), + BSON("x" << 10), + BSON("x" << 1), + true, + &errMsg)); env->waitForNthGetCursor(1u); @@ -199,15 +210,16 @@ namespace { env->addCursorId(ns, 345); string errMsg; - boost::thread deleterThread = boost::thread(boost::bind(&RangeDeleter::deleteNow, - &deleter, - noTxn, - ns, - BSON("x" << 0), - BSON("x" << 10), - BSON("x" << 1), - true, - &errMsg)); + boost::thread deleterThread = boost::thread(mongo::stdx::bind( + rangeDeleterDeleteNow, + &deleter, + noTxn, + ns, + BSON("x" << 0), + BSON("x" << 10), + BSON("x" << 1), + true, + &errMsg)); env->waitForNthGetCursor(1u); @@ -441,15 +453,16 @@ namespace { env->pauseDeletes(); string delErrMsg; - boost::thread deleterThread = boost::thread(boost::bind(&RangeDeleter::deleteNow, - &deleter, - noTxn, - ns, - BSON("x" << 64), - BSON("x" << 70), - BSON("x" << 1), - true, - &delErrMsg)); + boost::thread deleterThread = boost::thread(mongo::stdx::bind( + rangeDeleterDeleteNow, + &deleter, + noTxn, + ns, + BSON("x" << 64), + BSON("x" << 70), + BSON("x" << 1), + true, + &delErrMsg)); env->waitForNthPausedDelete(1u); diff --git a/src/mongo/db/repl/heartbeat.cpp b/src/mongo/db/repl/heartbeat.cpp index f6b627a70f9..afbebe3d615 100644 --- a/src/mongo/db/repl/heartbeat.cpp +++ b/src/mongo/db/repl/heartbeat.cpp @@ -171,7 +171,7 @@ namespace mongo { } // note that we got a heartbeat from this node - theReplSet->mgr->send(boost::bind(&ReplSet::msgUpdateHBRecv, + theReplSet->mgr->send(stdx::bind(&ReplSet::msgUpdateHBRecv, theReplSet, from->hbinfo().id(), time(0))); @@ -241,7 +241,7 @@ namespace mongo { */ void ReplSetImpl::startThreads() { task::fork(mgr); - mgr->send( boost::bind(&Manager::msgCheckNewState, theReplSet->mgr) ); + mgr->send( stdx::bind(&Manager::msgCheckNewState, theReplSet->mgr) ); if (myConfig().arbiterOnly) { return; @@ -253,7 +253,7 @@ namespace mongo { boost::thread t(startSyncThread); - boost::thread producer(boost::bind(&replset::BackgroundSync::producerThread, sync)); + boost::thread producer(stdx::bind(&replset::BackgroundSync::producerThread, sync)); theReplSet->syncSourceFeedback.go(); // member heartbeats are started in ReplSetImpl::initFromConfig diff --git a/src/mongo/db/repl/repl_set_health_poll_task.cpp b/src/mongo/db/repl/repl_set_health_poll_task.cpp index aa1b4a21406..4bd9f113654 100644 --- a/src/mongo/db/repl/repl_set_health_poll_task.cpp +++ b/src/mongo/db/repl/repl_set_health_poll_task.cpp @@ -94,7 +94,7 @@ namespace mongo { } m = mem; - theReplSet->mgr->send( boost::bind(&ReplSet::msgUpdateHBInfo, theReplSet, mem) ); + theReplSet->mgr->send( stdx::bind(&ReplSet::msgUpdateHBInfo, theReplSet, mem) ); static time_t last = 0; time_t now = time(0); @@ -106,7 +106,7 @@ namespace mongo { } if( changed || now-last>4 ) { last = now; - theReplSet->mgr->send( boost::bind(&Manager::msgCheckNewState, theReplSet->mgr) ); + theReplSet->mgr->send( stdx::bind(&Manager::msgCheckNewState, theReplSet->mgr) ); } } @@ -283,8 +283,8 @@ namespace mongo { BSONElement cfg = info["config"]; if( cfg.ok() ) { // received a new config - boost::function<void()> f = - boost::bind(&Manager::msgReceivedNewConfig, theReplSet->mgr, cfg.Obj().copy()); + stdx::function<void()> f = + stdx::bind(&Manager::msgReceivedNewConfig, theReplSet->mgr, cfg.Obj().copy()); theReplSet->mgr->send(f); } if (info.hasElement("electionTime")) { diff --git a/src/mongo/db/repl/repl_start.cpp b/src/mongo/db/repl/repl_start.cpp index ab99b49158c..2ca7650a6f9 100644 --- a/src/mongo/db/repl/repl_start.cpp +++ b/src/mongo/db/repl/repl_start.cpp @@ -28,7 +28,6 @@ #include "mongo/db/repl/repl_start.h" -#include <boost/bind.hpp> #include <boost/thread.hpp> #include <iostream> @@ -36,6 +35,7 @@ #include "mongo/db/repl/oplog.h" #include "mongo/db/repl/repl_settings.h" #include "mongo/db/repl/rs.h" +#include "mongo/stdx/functional.h" #include "mongo/util/log.h" namespace mongo { @@ -100,7 +100,7 @@ namespace mongo { replSet = true; ReplSetCmdline *replSetCmdline = new ReplSetCmdline(replSettings.replSet); - boost::thread t( boost::bind( &startReplSets, replSetCmdline) ); + boost::thread t( stdx::bind( &startReplSets, replSetCmdline) ); return; } diff --git a/src/mongo/db/repl/server.h b/src/mongo/db/repl/server.h index 5d67d93b588..9c4485a9902 100644 --- a/src/mongo/db/repl/server.h +++ b/src/mongo/db/repl/server.h @@ -31,8 +31,8 @@ #include <deque> #include <boost/thread/condition.hpp> -#include <boost/function.hpp> +#include "mongo/stdx/functional.h" #include "mongo/util/concurrency/mutex.h" #include "mongo/util/concurrency/task.h" @@ -40,7 +40,7 @@ namespace mongo { namespace task { - typedef boost::function<void()> lam; + typedef stdx::function<void()> lam; /** typical usage is: task::fork( new Server("threadname") ); */ class Server : public Task { diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp index 96e2207b3c6..b4c16fa47d7 100644 --- a/src/mongo/db/repl/sync_tail.cpp +++ b/src/mongo/db/repl/sync_tail.cpp @@ -337,7 +337,7 @@ namespace replset { // When would mgr be null? During replsettest'ing, in which case we should // fall through and actually apply ops as if we were a real secondary. if (mgr) { - mgr->send(boost::bind(&Manager::msgCheckNewState, theReplSet->mgr)); + mgr->send(stdx::bind(&Manager::msgCheckNewState, theReplSet->mgr)); sleepsecs(1); // There should never be ops to sync in a 1-member set, anyway return; diff --git a/src/mongo/db/structure/catalog/hashtab.h b/src/mongo/db/structure/catalog/hashtab.h index ca1d7fe752f..ac15b506ebf 100644 --- a/src/mongo/db/structure/catalog/hashtab.h +++ b/src/mongo/db/structure/catalog/hashtab.h @@ -172,7 +172,7 @@ namespace mongo { } } - // TODO: should probably use boost::bind for this, but didn't want to look at it + // TODO: should probably use stdx::bind for this, but didn't want to look at it typedef void (*IteratorCallback2)( const Key& k , Type& v , void * extra ); void iterAll( IteratorCallback2 callback , void * extra ) { for ( int i=0; i<n; i++ ) { diff --git a/src/mongo/db/structure/catalog/namespace_index.cpp b/src/mongo/db/structure/catalog/namespace_index.cpp index 99c6a5403ac..3bb52d27d6a 100644 --- a/src/mongo/db/structure/catalog/namespace_index.cpp +++ b/src/mongo/db/structure/catalog/namespace_index.cpp @@ -117,7 +117,7 @@ namespace mongo { void NamespaceIndex::getNamespaces( list<string>& tofill , bool onlyCollections ) const { verify( onlyCollections ); // TODO: need to implement this - // need boost::bind or something to make this less ugly + // need stdx::bind or something to make this less ugly if ( _ht.get() ) _ht->iterAll( namespaceGetNamespacesCallback , (void*)&tofill ); diff --git a/src/mongo/dbtests/counttests.cpp b/src/mongo/dbtests/counttests.cpp index 359e714140c..1ff84d735f8 100644 --- a/src/mongo/dbtests/counttests.cpp +++ b/src/mongo/dbtests/counttests.cpp @@ -189,7 +189,7 @@ namespace CountTests { public: WriterClientScope() : _state( Initial ), - _dummyWriter( boost::bind( &WriterClientScope::runDummyWriter, this ) ) { + _dummyWriter( stdx::bind( &WriterClientScope::runDummyWriter, this ) ) { _state.await( Ready ); } ~WriterClientScope() { diff --git a/src/mongo/dbtests/documentsourcetests.cpp b/src/mongo/dbtests/documentsourcetests.cpp index eb76afaebe2..982798161dc 100644 --- a/src/mongo/dbtests/documentsourcetests.cpp +++ b/src/mongo/dbtests/documentsourcetests.cpp @@ -290,7 +290,7 @@ namespace DocumentSourceTests { public: WriterClientScope() : _state( Initial ), - _dummyWriter( boost::bind( &WriterClientScope::runDummyWriter, this ) ) { + _dummyWriter( stdx::bind( &WriterClientScope::runDummyWriter, this ) ) { _state.await( Ready ); } ~WriterClientScope() { diff --git a/src/mongo/dbtests/mock/mock_dbclient_connection.cpp b/src/mongo/dbtests/mock/mock_dbclient_connection.cpp index 4f59f27353e..28a04779d25 100644 --- a/src/mongo/dbtests/mock/mock_dbclient_connection.cpp +++ b/src/mongo/dbtests/mock/mock_dbclient_connection.cpp @@ -117,7 +117,7 @@ namespace mongo { return _remoteServer->toString(); } - unsigned long long MockDBClientConnection::query(boost::function<void(const BSONObj&)> f, + unsigned long long MockDBClientConnection::query(stdx::function<void(const BSONObj&)> f, const string& ns, mongo::Query query, const BSONObj* fieldsToReturn, @@ -126,7 +126,7 @@ namespace mongo { return 0; } - unsigned long long MockDBClientConnection::query(boost::function<void( + unsigned long long MockDBClientConnection::query(stdx::function<void( mongo::DBClientCursorBatchIterator&)> f, const std::string& ns, mongo::Query query, diff --git a/src/mongo/dbtests/mock/mock_dbclient_connection.h b/src/mongo/dbtests/mock/mock_dbclient_connection.h index ff196346f6c..a4f902e4e7d 100644 --- a/src/mongo/dbtests/mock/mock_dbclient_connection.h +++ b/src/mongo/dbtests/mock/mock_dbclient_connection.h @@ -99,11 +99,11 @@ namespace mongo { // // Unsupported methods (defined to get rid of virtual function was hidden error) // - unsigned long long query(boost::function<void(const mongo::BSONObj&)> f, + unsigned long long query(stdx::function<void(const mongo::BSONObj&)> f, const std::string& ns, mongo::Query query, const mongo::BSONObj* fieldsToReturn = 0, int queryOptions = 0); - unsigned long long query(boost::function<void(mongo::DBClientCursorBatchIterator&)> f, + unsigned long long query(stdx::function<void(mongo::DBClientCursorBatchIterator&)> f, const std::string& ns, mongo::Query query, const mongo::BSONObj* fieldsToReturn = 0, int queryOptions = 0); diff --git a/src/mongo/dbtests/perftests.cpp b/src/mongo/dbtests/perftests.cpp index ce7e623c618..6e4d5d508ff 100644 --- a/src/mongo/dbtests/perftests.cpp +++ b/src/mongo/dbtests/perftests.cpp @@ -411,7 +411,7 @@ namespace PerfTests { return 0; } unsigned long long counter = 0; - boost::thread athread(boost::bind(&B::thread, this, &counter)); + boost::thread athread(stdx::bind(&B::thread, this, &counter)); unsigned long long child = launchThreads(remaining - 1); athread.join(); unsigned long long accum = child + counter; diff --git a/src/mongo/dbtests/threadedtests.cpp b/src/mongo/dbtests/threadedtests.cpp index 6ea888494bc..b5537364525 100644 --- a/src/mongo/dbtests/threadedtests.cpp +++ b/src/mongo/dbtests/threadedtests.cpp @@ -31,13 +31,13 @@ #include "mongo/pch.h" -#include <boost/bind.hpp> #include <boost/thread.hpp> #include "mongo/bson/util/atomic_int.h" #include "mongo/db/d_concurrency.h" #include "mongo/dbtests/dbtests.h" #include "mongo/platform/atomic_word.h" +#include "mongo/stdx/functional.h" #include "mongo/util/concurrency/mvar.h" #include "mongo/util/concurrency/thread_pool.h" #include "mongo/util/concurrency/list.h" @@ -75,7 +75,7 @@ namespace ThreadedTests { if (!remaining) return; - boost::thread athread(boost::bind(&ThreadedTest::subthread, this, remaining)); + boost::thread athread(stdx::bind(&ThreadedTest::subthread, this, remaining)); launch_subthreads(remaining - 1); athread.join(); } @@ -430,13 +430,13 @@ namespace ThreadedTests { auto_ptr<RWLockRecursiveNongreedy::Shared> a( new RWLockRecursiveNongreedy::Shared(lk) ); AtomicUInt32 x1(0); cout << "A : " << &x1 << endl; - boost::thread t1( boost::bind( worker1 , &lk , &x1 ) ); + boost::thread t1( stdx::bind( worker1 , &lk , &x1 ) ); while ( ! x1.load() ); verify( x1.load() == 1 ); sleepmillis( 500 ); verify( x1.load() == 1 ); AtomicUInt32 x2(0); - boost::thread t2( boost::bind( worker2, &lk , &x2 ) ); + boost::thread t2( stdx::bind( worker2, &lk , &x2 ) ); t2.join(); verify( x2.load() == 1 ); a.reset(); @@ -469,7 +469,7 @@ namespace ThreadedTests { AtomicUInt32 x2(0); - boost::thread t2( boost::bind( worker2, &lk , &x2 ) ); + boost::thread t2( stdx::bind( worker2, &lk , &x2 ) ); t2.join(); verify( x2.load() == 1 ); @@ -517,7 +517,7 @@ namespace ThreadedTests { verify( pthread_rwlock_rdlock( &lk ) == 0 ); AtomicUInt32 x1(0); - boost::thread t1( boost::bind( worker1 , &lk , &x1 ) ); + boost::thread t1( stdx::bind( worker1 , &lk , &x1 ) ); while ( ! x1.load() ); verify( x1.load() == 1 ); sleepmillis( 500 ); @@ -525,7 +525,7 @@ namespace ThreadedTests { AtomicUInt32 x2(0); - boost::thread t2( boost::bind( worker2, &lk , &x2 ) ); + boost::thread t2( stdx::bind( worker2, &lk , &x2 ) ); t2.join(); verify( x2.load() == 1 ); diff --git a/src/mongo/pch.h b/src/mongo/pch.h index c5a4d7ec3fd..617eeeb95ca 100644 --- a/src/mongo/pch.h +++ b/src/mongo/pch.h @@ -60,7 +60,6 @@ #define BOOST_FILESYSTEM_VERSION 3 #include <boost/shared_ptr.hpp> #include <boost/smart_ptr.hpp> -#include <boost/bind.hpp> #include <boost/version.hpp> #include "mongo/client/redef_macros.h" 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. diff --git a/src/mongo/scripting/bench.cpp b/src/mongo/scripting/bench.cpp index e2fee9b12b2..e6b25ebe0ff 100644 --- a/src/mongo/scripting/bench.cpp +++ b/src/mongo/scripting/bench.cpp @@ -315,7 +315,7 @@ namespace mongo { BenchRunWorker::~BenchRunWorker() {} void BenchRunWorker::start() { - boost::thread(boost::bind(&BenchRunWorker::run, this)); + boost::thread(stdx::bind(&BenchRunWorker::run, this)); } bool BenchRunWorker::shouldStop() const { @@ -446,7 +446,7 @@ namespace mongo { // use special query function for exhaust query option if (options & QueryOption_Exhaust) { BenchRunEventTrace _bret(&_stats.queryCounter); - boost::function<void (const BSONObj&)> castedDoNothing(doNothing); + stdx::function<void (const BSONObj&)> castedDoNothing(doNothing); count = conn->query(castedDoNothing, ns, fixedQuery, &filter, options); } else { diff --git a/src/mongo/scripting/bson_template_evaluator.h b/src/mongo/scripting/bson_template_evaluator.h index 73408c2ea41..f597686cf38 100644 --- a/src/mongo/scripting/bson_template_evaluator.h +++ b/src/mongo/scripting/bson_template_evaluator.h @@ -46,10 +46,10 @@ #include <map> #include <string> -#include <boost/function.hpp> #include <boost/noncopyable.hpp> #include "mongo/db/jsobj.h" +#include "mongo/stdx/functional.h" namespace mongo { @@ -94,7 +94,7 @@ namespace mongo { * fieldName : key * in : { #RAND_INT: [10, 20] } */ - typedef boost::function< Status (BsonTemplateEvaluator* btl, const char* fieldName, + typedef stdx::function< Status (BsonTemplateEvaluator* btl, const char* fieldName, const BSONObj& in, BSONObjBuilder& builder) > OperatorFn; BsonTemplateEvaluator(); diff --git a/src/mongo/scripting/v8-3.25_db.h b/src/mongo/scripting/v8-3.25_db.h index 632a8ad314f..fe93e1b6fbe 100644 --- a/src/mongo/scripting/v8-3.25_db.h +++ b/src/mongo/scripting/v8-3.25_db.h @@ -29,10 +29,10 @@ #pragma once -#include <boost/function.hpp> #include <v8.h> #include "mongo/scripting/engine_v8-3.25.h" +#include "mongo/stdx/functional.h" namespace mongo { @@ -171,7 +171,7 @@ namespace mongo { void collectionSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info); - typedef boost::function<void (V8Scope*, const v8::Local<v8::FunctionTemplate>&)> + typedef stdx::function<void (V8Scope*, const v8::Local<v8::FunctionTemplate>&)> V8FunctionPrototypeManipulatorFn; void v8RegisterMongoPrototypeManipulator(const V8FunctionPrototypeManipulatorFn& manipulator); diff --git a/src/mongo/scripting/v8_db.h b/src/mongo/scripting/v8_db.h index 894aec1a94a..5e9d02fed1a 100644 --- a/src/mongo/scripting/v8_db.h +++ b/src/mongo/scripting/v8_db.h @@ -29,10 +29,10 @@ #pragma once -#include <boost/function.hpp> #include <v8.h> #include "mongo/scripting/engine_v8.h" +#include "mongo/stdx/functional.h" namespace mongo { @@ -135,7 +135,7 @@ namespace mongo { v8::Handle<v8::Value> collectionSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info); - typedef boost::function<void (V8Scope*, const v8::Handle<v8::FunctionTemplate>&)> + typedef stdx::function<void (V8Scope*, const v8::Handle<v8::FunctionTemplate>&)> V8FunctionPrototypeManipulatorFn; void v8RegisterMongoPrototypeManipulator(const V8FunctionPrototypeManipulatorFn& manipulator); diff --git a/src/mongo/tools/dump.cpp b/src/mongo/tools/dump.cpp index a6ffd34e5f2..3c1f20d312d 100644 --- a/src/mongo/tools/dump.cpp +++ b/src/mongo/tools/dump.cpp @@ -103,7 +103,7 @@ public: // use low-latency "exhaust" mode if going over the network if (!_usingMongos && typeid(connBase) == typeid(DBClientConnection&)) { DBClientConnection& conn = static_cast<DBClientConnection&>(connBase); - boost::function<void(const BSONObj&)> castedWriter(writer); // needed for overload resolution + stdx::function<void(const BSONObj&)> castedWriter(writer); // needed for overload resolution conn.query( castedWriter, coll.c_str() , q , NULL, queryOptions | QueryOption_Exhaust); } else { diff --git a/src/mongo/tools/stat.cpp b/src/mongo/tools/stat.cpp index 499866fa331..3d62324b951 100644 --- a/src/mongo/tools/stat.cpp +++ b/src/mongo/tools/stat.cpp @@ -306,7 +306,7 @@ namespace mongo { state.reset( new ServerState() ); state->host = host; /* For each new thread, pass in a thread state object and the delta between samples */ - state->thr.reset( new boost::thread( boost::bind( serverThread, + state->thr.reset( new boost::thread( stdx::bind( serverThread, state, (int)ceil(_statUtil.getSeconds()) ) ) ); state->authParams = BSON(saslCommandUserFieldName << toolGlobalParams.username diff --git a/src/mongo/unittest/unittest.h b/src/mongo/unittest/unittest.h index e2306e72c41..72d94e2f266 100644 --- a/src/mongo/unittest/unittest.h +++ b/src/mongo/unittest/unittest.h @@ -39,13 +39,12 @@ #include <string> #include <vector> -#include <boost/bind.hpp> -#include <boost/function.hpp> #include <boost/noncopyable.hpp> #include <boost/scoped_ptr.hpp> #include <boost/shared_ptr.hpp> #include "mongo/logger/logstream_builder.h" +#include "mongo/stdx/functional.h" #include "mongo/util/assert_util.h" #include "mongo/util/mongoutils/str.h" @@ -191,7 +190,7 @@ namespace mongo { /** * Type representing the function composing a test. */ - typedef boost::function<void (void)> TestFunction; + typedef stdx::function<void (void)> TestFunction; /** * Container holding a test function and its name. Suites @@ -274,7 +273,7 @@ namespace mongo { template<class T , typename A > void add( const A& a ) { - add(demangleName(typeid(T)), boost::bind(&Suite::runTestObjectWithArg<T, A>, a)); + add(demangleName(typeid(T)), stdx::bind(&Suite::runTestObjectWithArg<T, A>, a)); } template<class T> diff --git a/src/mongo/util/background.cpp b/src/mongo/util/background.cpp index 0e24988fd09..21231162cff 100644 --- a/src/mongo/util/background.cpp +++ b/src/mongo/util/background.cpp @@ -31,12 +31,11 @@ #include "mongo/util/background.h" -#include <boost/bind.hpp> -#include <boost/function.hpp> #include <boost/thread/condition.hpp> #include <boost/thread/once.hpp> #include <boost/thread/thread.hpp> +#include "mongo/stdx/functional.h" #include "mongo/util/concurrency/mutex.h" #include "mongo/util/concurrency/spin_lock.h" #include "mongo/util/concurrency/thread_name.h" @@ -198,7 +197,7 @@ namespace mongo { // If the job is already 'done', for instance because it was cancelled or already // finished, ignore additional requests to run the job. if (_status->state == NotStarted) { - boost::thread t( boost::bind( &BackgroundJob::jobBody , this ) ); + boost::thread t( stdx::bind( &BackgroundJob::jobBody , this ) ); _status->state = Running; } } @@ -327,8 +326,8 @@ namespace mongo { // Use a shorter cycle time in debug mode to help catch race conditions. const size_t waitMillis = (debug ? 5 : 60) * 1000; - const boost::function<bool()> predicate = - boost::bind( &PeriodicTaskRunner::_isShutdownRequested, this ); + const stdx::function<bool()> predicate = + stdx::bind( &PeriodicTaskRunner::_isShutdownRequested, this ); mutex::scoped_lock lock( _mutex ); while ( !predicate() ) { diff --git a/src/mongo/util/concurrency/spin_lock_test.cpp b/src/mongo/util/concurrency/spin_lock_test.cpp index 9a7d9541220..75ec3cf9e24 100644 --- a/src/mongo/util/concurrency/spin_lock_test.cpp +++ b/src/mongo/util/concurrency/spin_lock_test.cpp @@ -28,6 +28,7 @@ #include <boost/thread/thread.hpp> +#include "mongo/stdx/functional.h" #include "mongo/unittest/unittest.h" #include "mongo/util/concurrency/spin_lock.h" #include "mongo/util/timer.h" @@ -47,7 +48,7 @@ namespace { } void start( int increments ) { - _t = new boost::thread( boost::bind(&LockTester::test, this, increments) ); + _t = new boost::thread( mongo::stdx::bind(&LockTester::test, this, increments) ); } void join() { diff --git a/src/mongo/util/concurrency/task.cpp b/src/mongo/util/concurrency/task.cpp index d55803b27a2..5f7b8acf221 100644 --- a/src/mongo/util/concurrency/task.cpp +++ b/src/mongo/util/concurrency/task.cpp @@ -119,7 +119,7 @@ namespace mongo { void Server::call( const lam& msg ) { Ret r; r.msg = &msg; - lam f = boost::bind(&Ret::f, &r); + lam f = stdx::bind(&Ret::f, &r); send(f); { scoped_lock lk(r.m); @@ -182,7 +182,7 @@ namespace mongo { class TaskUnitTest : public mongo::StartupTest { public: virtual void run() { - lam f = boost::bind(abc, 3); + lam f = stdx::bind(abc, 3); //f(); s = new Server("unittest"); diff --git a/src/mongo/util/concurrency/thread_pool.cpp b/src/mongo/util/concurrency/thread_pool.cpp index f1811e07dd3..feb2e6101bc 100644 --- a/src/mongo/util/concurrency/thread_pool.cpp +++ b/src/mongo/util/concurrency/thread_pool.cpp @@ -45,7 +45,7 @@ namespace mongo { explicit Worker(ThreadPool& owner) : _owner(owner) , _is_done(true) - , _thread(boost::bind(&Worker::loop, this)) + , _thread(stdx::bind(&Worker::loop, this)) {} // destructor will block until current operation is completed @@ -56,7 +56,7 @@ namespace mongo { } void set_task(Task& func) { - verify(!func.empty()); + verify(func); verify(_is_done); _is_done = false; @@ -72,7 +72,7 @@ namespace mongo { void loop() { while (true) { Task task = _task.take(); - if (task.empty()) + if (!task) break; // ends the thread try { diff --git a/src/mongo/util/concurrency/thread_pool.h b/src/mongo/util/concurrency/thread_pool.h index 8897ed06816..1366bbaa0cb 100644 --- a/src/mongo/util/concurrency/thread_pool.h +++ b/src/mongo/util/concurrency/thread_pool.h @@ -31,10 +31,9 @@ #include <list> -#include <boost/bind.hpp> -#include <boost/function.hpp> #include <boost/thread/condition.hpp> +#include "mongo/stdx/functional.h" #include "mongo/util/concurrency/mutex.h" namespace mongo { @@ -42,7 +41,7 @@ namespace mongo { namespace threadpool { class Worker; - typedef boost::function<void(void)> Task; //nullary function or functor + typedef stdx::function<void(void)> Task; //nullary function or functor // exported to the mongo namespace class ThreadPool : boost::noncopyable { @@ -61,18 +60,18 @@ namespace mongo { // task will be copied a few times so make sure it's relatively cheap void schedule(Task task); - // Helpers that wrap schedule and boost::bind. + // Helpers that wrap schedule and stdx::bind. // Functor and args will be copied a few times so make sure it's relatively cheap template<typename F, typename A> - void schedule(F f, A a) { schedule(boost::bind(f,a)); } + void schedule(F f, A a) { schedule(stdx::bind(f,a)); } template<typename F, typename A, typename B> - void schedule(F f, A a, B b) { schedule(boost::bind(f,a,b)); } + void schedule(F f, A a, B b) { schedule(stdx::bind(f,a,b)); } template<typename F, typename A, typename B, typename C> - void schedule(F f, A a, B b, C c) { schedule(boost::bind(f,a,b,c)); } + void schedule(F f, A a, B b, C c) { schedule(stdx::bind(f,a,b,c)); } template<typename F, typename A, typename B, typename C, typename D> - void schedule(F f, A a, B b, C c, D d) { schedule(boost::bind(f,a,b,c,d)); } + void schedule(F f, A a, B b, C c, D d) { schedule(stdx::bind(f,a,b,c,d)); } template<typename F, typename A, typename B, typename C, typename D, typename E> - void schedule(F f, A a, B b, C c, D d, E e) { schedule(boost::bind(f,a,b,c,d,e)); } + void schedule(F f, A a, B b, C c, D d, E e) { schedule(stdx::bind(f,a,b,c,d,e)); } int tasks_remaining() { return _tasksRemaining; } diff --git a/src/mongo/util/concurrency/threadlocal.h b/src/mongo/util/concurrency/threadlocal.h index a9b0b428a26..cad8b4966ba 100644 --- a/src/mongo/util/concurrency/threadlocal.h +++ b/src/mongo/util/concurrency/threadlocal.h @@ -30,7 +30,6 @@ #include "mongo/client/undef_macros.h" #include <boost/thread/tss.hpp> -#include <boost/bind.hpp> #include "mongo/client/redef_macros.h" diff --git a/src/mongo/util/file_allocator.cpp b/src/mongo/util/file_allocator.cpp index 87bb33ccf36..741c59fcb4f 100644 --- a/src/mongo/util/file_allocator.cpp +++ b/src/mongo/util/file_allocator.cpp @@ -50,6 +50,7 @@ #endif #include "mongo/platform/posix_fadvise.h" +#include "mongo/stdx/functional.h" #include "mongo/util/concurrency/thread_name.h" #include "mongo/util/mongoutils/str.h" #include "mongo/util/paths.h" @@ -98,7 +99,7 @@ namespace mongo { void FileAllocator::start() { - boost::thread t( boost::bind( &FileAllocator::run , this ) ); + boost::thread t( stdx::bind( &FileAllocator::run , this ) ); } void FileAllocator::requestAllocation( const string &name, long &size ) { diff --git a/src/mongo/util/net/message_server_asio.cpp b/src/mongo/util/net/message_server_asio.cpp index eaaeef8ee0c..b4e1b9d1c65 100644 --- a/src/mongo/util/net/message_server_asio.cpp +++ b/src/mongo/util/net/message_server_asio.cpp @@ -124,7 +124,7 @@ namespace mongo { _cur.setData( data , true ); async_read( _socket , buffer( raw + sizeof( _inHeader ) , _inHeader.len - sizeof( _inHeader ) ) , - boost::bind( &MessageServerSession::handleReadBody , shared_from_this() , boost::asio::placeholders::error ) ); + stdx::bind( &MessageServerSession::handleReadBody , shared_from_this() , boost::asio::placeholders::error ) ); } void handleReadBody( const boost::system::error_code& error ) { @@ -150,7 +150,7 @@ namespace mongo { if (_reply.data) { async_write( _socket , buffer( (char*)_reply.data , _reply.data->len ) , - boost::bind( &MessageServerSession::handleWriteDone , shared_from_this() , boost::asio::placeholders::error ) ); + stdx::bind( &MessageServerSession::handleWriteDone , shared_from_this() , boost::asio::placeholders::error ) ); } else { _cur.reset(); @@ -196,7 +196,7 @@ namespace mongo { _inHeader.len = 0; async_read( _socket , buffer( &_inHeader , sizeof( _inHeader ) ) , - boost::bind( &MessageServerSession::handleReadHeader , shared_from_this() , boost::asio::placeholders::error ) ); + stdx::bind( &MessageServerSession::handleReadHeader , shared_from_this() , boost::asio::placeholders::error ) ); } MessageHandler * _handler; @@ -231,7 +231,7 @@ namespace mongo { void run() { cout << "AsyncMessageServer starting to listen on: " << _port << endl; - boost::thread other(boost::bind(&io_service::run, &_ioservice)); + boost::thread other(stdx::bind(&io_service::run, &_ioservice)); _ioservice.run(); cout << "AsyncMessageServer done listening on: " << _port << endl; } @@ -249,7 +249,7 @@ namespace mongo { void _accept( ) { shared_ptr<MessageServerSession> session( new MessageServerSession( _handler , _ioservice ) ); _acceptor.async_accept( session->socket() , - boost::bind( &AsyncMessageServer::handleAccept, + stdx::bind( &AsyncMessageServer::handleAccept, this, session, boost::asio::placeholders::error ) diff --git a/src/mongo/util/net/message_server_port.cpp b/src/mongo/util/net/message_server_port.cpp index fa41b727a2b..0af5fa698cf 100644 --- a/src/mongo/util/net/message_server_port.cpp +++ b/src/mongo/util/net/message_server_port.cpp @@ -36,6 +36,7 @@ #include "mongo/db/lasterror.h" #include "mongo/db/stats/counters.h" +#include "mongo/stdx/functional.h" #include "mongo/util/concurrency/thread_name.h" #include "mongo/util/concurrency/ticketholder.h" #include "mongo/util/exit.h" @@ -81,7 +82,7 @@ namespace mongo { #ifndef __linux__ // TODO: consider making this ifdef _WIN32 { HandleIncomingMsgParam* himParam = new HandleIncomingMsgParam(p, _handler); - boost::thread thr(boost::bind(&handleIncomingMsg, himParam)); + boost::thread thr(stdx::bind(&handleIncomingMsg, himParam)); } #else pthread_attr_t attrs; diff --git a/src/mongo/util/net/sock_test.cpp b/src/mongo/util/net/sock_test.cpp index 2a54b6fa91d..bf82cec7aa9 100644 --- a/src/mongo/util/net/sock_test.cpp +++ b/src/mongo/util/net/sock_test.cpp @@ -147,12 +147,12 @@ namespace { Notification accepted; SOCKET acceptSock = INVALID_SOCKET; boost::thread acceptor( - boost::bind(&detail::awaitAccept, &acceptSock, listenSock, boost::ref(accepted))); + stdx::bind(&detail::awaitAccept, &acceptSock, listenSock, boost::ref(accepted))); Notification connected; SOCKET connectSock = INVALID_SOCKET; boost::thread connector( - boost::bind(&detail::awaitConnect, &connectSock, *connectRes, boost::ref(connected))); + stdx::bind(&detail::awaitConnect, &connectSock, *connectRes, boost::ref(connected))); connected.waitToBeNotified(); if (connectSock == INVALID_SOCKET) { |