diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/client/scoped_db_conn_test.cpp | 1 | ||||
-rw-r--r-- | src/mongo/db/client.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/repl/network_interface_impl.cpp | 5 | ||||
-rw-r--r-- | src/mongo/dbtests/threadedtests.cpp | 5 | ||||
-rw-r--r-- | src/mongo/stdx/thread.h | 40 | ||||
-rw-r--r-- | src/mongo/util/fail_point_test.cpp | 8 |
6 files changed, 52 insertions, 10 deletions
diff --git a/src/mongo/client/scoped_db_conn_test.cpp b/src/mongo/client/scoped_db_conn_test.cpp index b8aec56844f..1ba4095c90e 100644 --- a/src/mongo/client/scoped_db_conn_test.cpp +++ b/src/mongo/client/scoped_db_conn_test.cpp @@ -104,7 +104,6 @@ namespace mongo { } virtual void process(Message& m, AbstractMessagingPort* por) { - boost::this_thread::interruption_point(); } }; } diff --git a/src/mongo/db/client.cpp b/src/mongo/db/client.cpp index a2e510f4bb0..f323bcfe02c 100644 --- a/src/mongo/db/client.cpp +++ b/src/mongo/db/client.cpp @@ -42,6 +42,7 @@ #include "mongo/base/status.h" #include "mongo/db/lasterror.h" #include "mongo/db/service_context.h" +#include "mongo/stdx/thread.h" #include "mongo/util/concurrency/thread_name.h" #include "mongo/util/exit.h" #include "mongo/util/mongoutils/str.h" @@ -93,7 +94,7 @@ namespace mongo { AbstractMessagingPort *p) : ClientBasic(serviceContext, p), _desc(std::move(desc)), - _threadId(boost::this_thread::get_id()), + _threadId(stdx::this_thread::get_id()), _connectionId(p ? p->connectionId() : 0) { } diff --git a/src/mongo/db/repl/network_interface_impl.cpp b/src/mongo/db/repl/network_interface_impl.cpp index 120125aae72..e5b4fb94bfd 100644 --- a/src/mongo/db/repl/network_interface_impl.cpp +++ b/src/mongo/db/repl/network_interface_impl.cpp @@ -40,6 +40,7 @@ #include "mongo/db/client.h" #include "mongo/db/operation_context_impl.h" #include "mongo/rpc/get_status_from_command_result.h" +#include "mongo/stdx/thread.h" #include "mongo/util/assert_util.h" #include "mongo/util/log.h" #include "mongo/util/time_support.h" @@ -215,7 +216,7 @@ namespace { // This thread is ending because it was idle for too long. // Find self in _threads, remove self from _threads, detach self. for (size_t i = 0; i < _threads.size(); ++i) { - if (_threads[i]->get_id() != boost::this_thread::get_id()) { + if (_threads[i]->get_id() != stdx::this_thread::get_id()) { continue; } _threads[i]->detach(); @@ -224,7 +225,7 @@ namespace { return; } severe().stream() << "Could not find this thread, with id " << - boost::this_thread::get_id() << " in the replication networking thread pool"; + stdx::this_thread::get_id() << " in the replication networking thread pool"; fassertFailedNoTrace(28581); } diff --git a/src/mongo/dbtests/threadedtests.cpp b/src/mongo/dbtests/threadedtests.cpp index b663ccc160c..4470387aeac 100644 --- a/src/mongo/dbtests/threadedtests.cpp +++ b/src/mongo/dbtests/threadedtests.cpp @@ -45,6 +45,7 @@ #include "mongo/platform/atomic_word.h" #include "mongo/platform/bits.h" #include "mongo/stdx/functional.h" +#include "mongo/stdx/thread.h" #include "mongo/util/concurrency/mvar.h" #include "mongo/util/concurrency/rwlock.h" #include "mongo/util/concurrency/thread_pool.h" @@ -302,7 +303,7 @@ namespace ThreadedTests { int val = target.take(); #if BOOST_VERSION >= 103500 //increase chances of catching failure - boost::this_thread::yield(); + stdx::this_thread::yield(); #endif target.put(val+1); } @@ -574,7 +575,7 @@ namespace ThreadedTests { void sleepalittle() { Timer t; while( 1 ) { - boost::this_thread::yield(); + stdx::this_thread::yield(); if( t.micros() > 8 ) break; } diff --git a/src/mongo/stdx/thread.h b/src/mongo/stdx/thread.h new file mode 100644 index 00000000000..692dfbeb6a1 --- /dev/null +++ b/src/mongo/stdx/thread.h @@ -0,0 +1,40 @@ +/** + * Copyright (C) 2015 MongoDB Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * As a special exception, the copyright holders give permission to link the + * code of portions of this program with the OpenSSL library under certain + * conditions as described in each individual source file and distribute + * linked combinations including the program with the OpenSSL library. You + * must comply with the GNU Affero General Public License in all respects for + * all of the code used other than as permitted herein. If you modify file(s) + * with this exception, you may extend this exception to your version of the + * file(s), but you are not obligated to do so. If you do not wish to do so, + * delete this exception statement from your version. If you delete this + * exception statement from all source files in the program, then also delete + * it in the license file. + */ + +#pragma once + +#include <boost/thread.hpp> + +namespace mongo { +namespace stdx { + + namespace this_thread = boost::this_thread; + +} // namespace stdx +} // namespace mongo + diff --git a/src/mongo/util/fail_point_test.cpp b/src/mongo/util/fail_point_test.cpp index 17be424f244..5dfc185c585 100644 --- a/src/mongo/util/fail_point_test.cpp +++ b/src/mongo/util/fail_point_test.cpp @@ -200,7 +200,7 @@ namespace mongo_test { } } - boost::this_thread::interruption_point(); + stdx::this_thread::interruption_point(); } } @@ -222,14 +222,14 @@ namespace mongo_test { catch (const std::logic_error&) { } - boost::this_thread::interruption_point(); + stdx::this_thread::interruption_point(); } } static void simpleTask(FailPoint* failPoint) { while (true) { static_cast<void>(MONGO_FAIL_POINT((*failPoint))); - boost::this_thread::interruption_point(); + stdx::this_thread::interruption_point(); } } @@ -242,7 +242,7 @@ namespace mongo_test { failPoint->setMode(FailPoint::alwaysOn, 0, BSON("a" << 44)); } - boost::this_thread::interruption_point(); + stdx::this_thread::interruption_point(); } } |