diff options
Diffstat (limited to 'xmrstak/backend/globalStates.hpp')
-rw-r--r-- | xmrstak/backend/globalStates.hpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/xmrstak/backend/globalStates.hpp b/xmrstak/backend/globalStates.hpp new file mode 100644 index 0000000..a9818ba --- /dev/null +++ b/xmrstak/backend/globalStates.hpp @@ -0,0 +1,35 @@ +#pragma once +#include <atomic> +#include "miner_work.h" +#include "../Environment.hpp" + +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 |