summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLutz Bichler <Lutz.Bichler@bmw.de>2015-04-13 15:18:51 +0200
committerLutz Bichler <Lutz.Bichler@bmw.de>2015-04-13 15:18:51 +0200
commit169e75bfcb1afe03eaf182ebc33925a2757b741f (patch)
tree49cfc921c66a0844aacd6978db01300fc9f1dd1e
parentfe6264e46124fa74e11a03aab5a1afc1a2447460 (diff)
downloadgenivi-common-api-runtime-169e75bfcb1afe03eaf182ebc33925a2757b741f.tar.gz
Separated runtime initialization from access to it.
-rw-r--r--include/CommonAPI/Runtime.hpp2
-rw-r--r--src/CommonAPI/Runtime.cpp5
2 files changed, 5 insertions, 2 deletions
diff --git a/include/CommonAPI/Runtime.hpp b/include/CommonAPI/Runtime.hpp
index 49c5030..9672fe7 100644
--- a/include/CommonAPI/Runtime.hpp
+++ b/include/CommonAPI/Runtime.hpp
@@ -185,6 +185,8 @@ private:
std::mutex factoriesMutex_;
std::mutex loadMutex_;
+ static std::shared_ptr<Runtime> theRuntime__;
+
friend class ProxyManager;
};
diff --git a/src/CommonAPI/Runtime.cpp b/src/CommonAPI/Runtime.cpp
index 9a6cb4f..6e19f07 100644
--- a/src/CommonAPI/Runtime.cpp
+++ b/src/CommonAPI/Runtime.cpp
@@ -27,9 +27,10 @@ const char *COMMONAPI_DEFAULT_FOLDER = "/usr/local/lib/commonapi";
const char *COMMONAPI_DEFAULT_CONFIG_FILE = "commonapi.ini";
const char *COMMONAPI_DEFAULT_CONFIG_FOLDER = "/etc";
+std::shared_ptr<Runtime> Runtime::theRuntime__ = std::make_shared<Runtime>();
+
std::shared_ptr<Runtime> Runtime::get() {
- static std::shared_ptr<Runtime> theRuntime = std::make_shared<Runtime>();
- return theRuntime;
+ return theRuntime__;
}
Runtime::Runtime()