-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMiningContext.cpp
39 lines (35 loc) · 1.39 KB
/
MiningContext.cpp
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
39
//
// Created by Pedro Guzman on 7/4/17.
//
#include "MiningContext.h"
// -----------------------------------------------------------------------
// METHOD IS RUNNING
// -----------------------------------------------------------------------
/**
* Gets if current mining context is running or not. This method is used by
* multiple mining threads to determine if they should run or stop running.
* @return true if runnning or false is stopped.
*/
bool MiningContext::isRunning() {
return this->_isRunning;
} // METHOD IS RUNNING ENDS ----------------------------------------------
// -----------------------------------------------------------------------
// METHOD INIT
// -----------------------------------------------------------------------
/**
* Sets the mining context to run so that mining threads can run their mining
* agents.
*/
void MiningContext::init() {
this->_isRunning = true;
} // METHOD INIT ENDS ----------------------------------------------------
// -----------------------------------------------------------------------
// METHOD STOP
// -----------------------------------------------------------------------
/**
* Sets a signal in the context to tell all running agents, that mining
* context has finished so execution must be ended.
*/
void MiningContext::stop() {
this->_isRunning = false;
} // METHOD STOP ENDS ----------------------------------------------------