daemon mode feature

This commit is contained in:
fireice-uk
2017-05-26 19:36:38 +01:00
parent 07ea73dbc3
commit 83762e5bed
6 changed files with 21 additions and 6 deletions
+1 -1
View File
@@ -153,7 +153,7 @@ int main(int argc, char *argv[])
if(strlen(jconf::inst()->GetOutputFile()) != 0)
printer::inst()->open_logfile(jconf::inst()->GetOutputFile());
executor::inst()->ex_start();
executor::inst()->ex_start(jconf::inst()->DaemonMode());
using namespace std::chrono;
uint64_t lastTime = time_point_cast<milliseconds>(high_resolution_clock::now()).time_since_epoch().count();
+8
View File
@@ -139,6 +139,14 @@ null,
*/
"h_print_time" : 60,
/*
* Daemon mode
*
* If you are running the process in the background and you don't need the keyboard reports, set this to true.
* This should solve the hashrate problems on some emulated terminals.
*/
"daemon_mode" : false,
/*
* Output file
*
-1
View File
@@ -43,7 +43,6 @@ executor* executor::oInst = NULL;
executor::executor()
{
my_thd = nullptr;
}
void executor::push_timed_event(ex_event&& ev, size_t sec)
+3 -3
View File
@@ -19,8 +19,7 @@ public:
return oInst;
};
void ex_start() { my_thd = new std::thread(&executor::ex_main, this); }
void ex_main();
void ex_start(bool daemon) { daemon ? ex_main() : std::thread(&executor::ex_main, this).detach(); }
void get_http_report(ex_event_name ev_id, std::string& data);
@@ -53,7 +52,6 @@ private:
telemetry* telem;
std::vector<minethd*>* pvThreads;
std::thread* my_thd;
size_t current_pool_id;
@@ -67,6 +65,8 @@ private:
executor();
static executor* oInst;
void ex_main();
void ex_clock_thd();
void pool_connect(jpsock* pool);
+7 -1
View File
@@ -48,7 +48,7 @@ using namespace rapidjson;
enum configEnum { aCpuThreadsConf, sUseSlowMem, bNiceHashMode,
bTlsMode, bTlsSecureAlgo, sTlsFingerprint, sPoolAddr, sWalletAddr, sPoolPwd,
iCallTimeout, iNetRetry, iGiveUpLimit, iVerboseLevel, iAutohashTime,
sOutputFile, iHttpdPort, bPreferIpv4 };
bDaemonMode, sOutputFile, iHttpdPort, bPreferIpv4 };
struct configVal {
configEnum iName;
@@ -73,6 +73,7 @@ configVal oConfigValues[] = {
{ iGiveUpLimit, "giveup_limit", kNumberType },
{ iVerboseLevel, "verbose_level", kNumberType },
{ iAutohashTime, "h_print_time", kNumberType },
{ bDaemonMode, "daemon_mode", kTrueType },
{ sOutputFile, "output_file", kStringType },
{ iHttpdPort, "httpd_port", kNumberType },
{ bPreferIpv4, "prefer_ipv4", kTrueType }
@@ -251,6 +252,11 @@ bool jconf::NiceHashMode()
return prv->configValues[bNiceHashMode]->GetBool();
}
bool jconf::DaemonMode()
{
return prv->configValues[bDaemonMode]->GetBool();
}
const char* jconf::GetOutputFile()
{
return prv->configValues[sOutputFile]->GetString();
+2
View File
@@ -54,6 +54,8 @@ public:
bool NiceHashMode();
bool DaemonMode();
bool PreferIpv4();
inline bool HaveHardwareAes() { return bHaveAes; }