diff options
Diffstat (limited to 'src/mongo/transport/transport_layer_asio.cpp')
-rw-r--r-- | src/mongo/transport/transport_layer_asio.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mongo/transport/transport_layer_asio.cpp b/src/mongo/transport/transport_layer_asio.cpp index 3593cc7673a..387a0943d10 100644 --- a/src/mongo/transport/transport_layer_asio.cpp +++ b/src/mongo/transport/transport_layer_asio.cpp @@ -288,8 +288,11 @@ TransportLayerASIO::Options::Options(const ServerGlobalParams* params) maxConns(params->maxConns) { } -TransportLayerASIO::TimerService::TimerService() - : _reactor(std::make_shared<TransportLayerASIO::ASIOReactor>()) {} +TransportLayerASIO::TimerService::TimerService(Options opt) + : _reactor(std::make_shared<TransportLayerASIO::ASIOReactor>()) { + if (opt.spawn) + _spawn = std::move(opt.spawn); +} TransportLayerASIO::TimerService::~TimerService() { stop(); @@ -307,7 +310,7 @@ void TransportLayerASIO::TimerService::start() { auto lk = stdx::lock_guard(_mutex); auto precondition = State::kInitialized; if (_state.compareAndSwap(&precondition, State::kStarted)) { - _thread = stdx::thread([reactor = _reactor] { + _thread = _spawn([reactor = _reactor] { LOGV2_INFO(5490002, "Started a new thread for the timer service"); reactor->run(); LOGV2_INFO(5490003, "Returning from the timer service thread"); |