summaryrefslogtreecommitdiffstats
path: root/xmrstak/backend/globalStates.hpp
blob: 73ccf743e59982286fbf54fd035f74ac274817b4 (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
36
37
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
OpenPOWER on IntegriCloud