summaryrefslogtreecommitdiff
path: root/src/mongo/db/db.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/db.cpp')
-rw-r--r--src/mongo/db/db.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index e79178ed28c..ac10b378700 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -1228,6 +1228,8 @@ void shutdownTask(const ShutdownTaskArgs& shutdownArgs) {
}
int mongoDbMain(int argc, char* argv[], char** envp) {
+ ThreadSafetyContext::getThreadSafetyContext()->forbidMultiThreading();
+
registerShutdownTask(shutdownTask);
setupSignalHandlers();
@@ -1277,6 +1279,9 @@ int mongoDbMain(int argc, char* argv[], char** envp) {
if (!initializeServerSecurityGlobalState(service))
quickExit(EXIT_FAILURE);
+ // There is no single-threaded guarantee beyond this point.
+ ThreadSafetyContext::getThreadSafetyContext()->allowMultiThreading();
+
// Per SERVER-7434, startSignalProcessingThread must run after any forks (i.e.
// initializeServerGlobalState) and before the creation of any other threads
startSignalProcessingThread();