diff options
author | Mathias Stearn <mathias@10gen.com> | 2016-05-09 11:14:45 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2016-05-09 17:52:12 -0400 |
commit | 9dc08e38ada5a8567753469e688c821c8b96530e (patch) | |
tree | 6113f8df0fc8b0574ddf31a5107e4fd7951c18fd /src/mongo/db/service_context.cpp | |
parent | 3555c1363e02c64511d8826a57289275c13491c0 (diff) | |
download | mongo-9dc08e38ada5a8567753469e688c821c8b96530e.tar.gz |
SERVER-18277 Fill in clock and tick sources in ServiceContext constructor
Now they only need to be set in cases where the defaults need to be changed.
Tests that just want the defaults can link against
$BUILD_DIR/mongo/db/service_context_noop_init to get a working global
ServiceContext.
Diffstat (limited to 'src/mongo/db/service_context.cpp')
-rw-r--r-- | src/mongo/db/service_context.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/db/service_context.cpp b/src/mongo/db/service_context.cpp index 5f3e2e34643..6f42a4a547b 100644 --- a/src/mongo/db/service_context.cpp +++ b/src/mongo/db/service_context.cpp @@ -36,6 +36,8 @@ #include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/mongoutils/str.h" +#include "mongo/util/system_clock_source.h" +#include "mongo/util/system_tick_source.h" namespace mongo { @@ -112,6 +114,11 @@ Status validateStorageOptions( return Status::OK(); } +ServiceContext::ServiceContext() + : _tickSource(stdx::make_unique<SystemTickSource>()), + _fastClockSource(stdx::make_unique<SystemClockSource>()), + _preciseClockSource(stdx::make_unique<SystemClockSource>()) {} + ServiceContext::~ServiceContext() { stdx::lock_guard<stdx::mutex> lk(_mutex); invariant(_clients.empty()); |