summaryrefslogtreecommitdiff
path: root/src/mongo/base/init.cpp
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@10gen.com>2012-09-17 12:19:26 -0400
committerAndy Schwerin <schwerin@10gen.com>2012-09-25 15:57:08 -0400
commit635aed09b0de72588422f1b864cca3810979375c (patch)
tree110365fc2105146c248025ef06e95db70ef3721b /src/mongo/base/init.cpp
parent1c9b2a7d236cce265db1b29a708959fe87ba56ca (diff)
downloadmongo-635aed09b0de72588422f1b864cca3810979375c.tar.gz
SERVER-5112 Introduce runGlobalInitializers(), macros and tools for global initializer declaration.
These utilities simplify adding global (process-wide) initializers that run at the beginning of main(). Also, run the global initializers in the main() of unittests.
Diffstat (limited to 'src/mongo/base/init.cpp')
-rw-r--r--src/mongo/base/init.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/mongo/base/init.cpp b/src/mongo/base/init.cpp
new file mode 100644
index 00000000000..c03e63dd786
--- /dev/null
+++ b/src/mongo/base/init.cpp
@@ -0,0 +1,23 @@
+/* Copyright 2012 10gen Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mongo/base/init.h"
+
+MONGO_INITIALIZER_GROUP(default, MONGO_NO_PREREQUISITES, MONGO_NO_DEPENDENTS)
+
+MONGO_INITIALIZER_GROUP(globalVariableConfigurationStarted, MONGO_NO_PREREQUISITES, MONGO_NO_DEPENDENTS)
+MONGO_INITIALIZER_GROUP(globalVariablesDeclared, ("globalVariableConfigurationStarted"), MONGO_NO_DEPENDENTS)
+MONGO_INITIALIZER_GROUP(globalVariablesSet, ("globalVariablesDeclared"), MONGO_NO_DEPENDENTS)
+MONGO_INITIALIZER_GROUP(globalVariablesConfigured, ("globalVariablesDeclared"), ("default"))