From a4074a1ac2e8941788403cf1d25d140972058e8a Mon Sep 17 00:00:00 2001 From: Benety Goh Date: Thu, 7 Jul 2016 19:05:52 -0400 Subject: SERVER-24945 added support to ThreadPoolMock for post-initialization function on worker thread. --- src/mongo/executor/thread_pool_mock.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/mongo/executor/thread_pool_mock.cpp') diff --git a/src/mongo/executor/thread_pool_mock.cpp b/src/mongo/executor/thread_pool_mock.cpp index 026ef72b9ad..ab19d6994c8 100644 --- a/src/mongo/executor/thread_pool_mock.cpp +++ b/src/mongo/executor/thread_pool_mock.cpp @@ -38,8 +38,8 @@ namespace mongo { namespace executor { -ThreadPoolMock::ThreadPoolMock(NetworkInterfaceMock* net, int32_t prngSeed) - : _prng(prngSeed), _net(net) {} +ThreadPoolMock::ThreadPoolMock(NetworkInterfaceMock* net, int32_t prngSeed, Options options) + : _options(std::move(options)), _prng(prngSeed), _net(net) {} ThreadPoolMock::~ThreadPoolMock() { stdx::unique_lock lk(_mutex); @@ -64,6 +64,7 @@ void ThreadPoolMock::startup() { invariant(!_worker.joinable()); _started = true; _worker = stdx::thread([this] { + _options.onCreateThread(); stdx::unique_lock lk(_mutex); consumeTasks(&lk); }); -- cgit v1.2.1