diff options
author | Benety Goh <benety@mongodb.com> | 2016-07-07 19:05:52 -0400 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2016-07-11 10:34:29 -0400 |
commit | a4074a1ac2e8941788403cf1d25d140972058e8a (patch) | |
tree | 6f3bc6e5fc0e93c101c9b678e71881ddc6ccc07b /src/mongo/executor/thread_pool_mock.cpp | |
parent | 610550f332359bc50e264ffe189c3125fd02980e (diff) | |
download | mongo-a4074a1ac2e8941788403cf1d25d140972058e8a.tar.gz |
SERVER-24945 added support to ThreadPoolMock for post-initialization function on worker thread.
Diffstat (limited to 'src/mongo/executor/thread_pool_mock.cpp')
-rw-r--r-- | src/mongo/executor/thread_pool_mock.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
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<stdx::mutex> lk(_mutex); @@ -64,6 +64,7 @@ void ThreadPoolMock::startup() { invariant(!_worker.joinable()); _started = true; _worker = stdx::thread([this] { + _options.onCreateThread(); stdx::unique_lock<stdx::mutex> lk(_mutex); consumeTasks(&lk); }); |