diff options
Diffstat (limited to 'xmrstak/backend/globalStates.hpp')
-rw-r--r-- | xmrstak/backend/globalStates.hpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/xmrstak/backend/globalStates.hpp b/xmrstak/backend/globalStates.hpp new file mode 100644 index 0000000..73ccf74 --- /dev/null +++ b/xmrstak/backend/globalStates.hpp @@ -0,0 +1,38 @@ +#pragma once + +#include "miner_work.hpp" +#include "xmrstak/misc/environment.hpp" + +#include <atomic> + + +namespace xmrstak +{ + +struct globalStates +{ + + static inline globalStates& inst() + { + auto& env = environment::inst(); + if(env.pglobalStates == nullptr) + env.pglobalStates = new globalStates; + return *env.pglobalStates; + } + + void switch_work(miner_work& pWork); + + miner_work oGlobalWork; + std::atomic<uint64_t> iGlobalJobNo; + std::atomic<uint64_t> iConsumeCnt; + uint64_t iThreadCount; + + private: + + globalStates() : iThreadCount(0) + { + } + +}; + +} // namepsace xmrstak |