summaryrefslogtreecommitdiffstats
path: root/xmrstak/misc
diff options
context:
space:
mode:
Diffstat (limited to 'xmrstak/misc')
-rw-r--r--xmrstak/misc/environment.hpp41
1 files changed, 18 insertions, 23 deletions
diff --git a/xmrstak/misc/environment.hpp b/xmrstak/misc/environment.hpp
index 6140d7d..87c512a 100644
--- a/xmrstak/misc/environment.hpp
+++ b/xmrstak/misc/environment.hpp
@@ -12,35 +12,30 @@ class params;
struct environment
{
-
- static environment& inst()
- {
- static environment env;
- return env;
- }
-
- environment& operator=(const environment& env)
+ static inline environment& inst(environment* init = nullptr)
{
- this->pPrinter = env.pPrinter;
- this->pglobalStates = env.pglobalStates;
- this->pJconfConfig = env.pJconfConfig;
- this->pExecutor = env.pExecutor;
- this->pParams = env.pParams;
- return *this;
- }
+ static environment* env = nullptr;
+ if(env == nullptr)
+ {
+ if(init != nullptr)
+ env = new environment;
+ else
+ env = init;
+ }
- environment() : pPrinter(nullptr), pglobalStates(nullptr)
- {
+ return *env;
}
+ environment()
+ {
+ }
- printer* pPrinter;
- globalStates* pglobalStates;
- jconf* pJconfConfig;
- executor* pExecutor;
- params* pParams;
-
+ printer* pPrinter = nullptr;
+ globalStates* pglobalStates = nullptr;
+ jconf* pJconfConfig = nullptr;
+ executor* pExecutor = nullptr;
+ params* pParams = nullptr;
};
} // namepsace xmrstak
OpenPOWER on IntegriCloud