summaryrefslogtreecommitdiffstats
path: root/xmrstak/backend/globalStates.hpp
blob: a9818baa46a550c53abd13d1a26458164ce81c5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
OpenPOWER on IntegriCloud