diff options
author | fireice-uk <fireice-uk@users.noreply.github.com> | 2017-05-26 19:36:38 +0100 |
---|---|---|
committer | fireice-uk <fireice-uk@users.noreply.github.com> | 2017-05-26 19:36:38 +0100 |
commit | 83762e5bedfef2d0aa25552bc8aeae7afb8f2b5e (patch) | |
tree | efc13f5a9fb71781f464fe4bc5d67e3604e9c000 | |
parent | 07ea73dbc3e71eb68ed6b5c10c6fd83f2357c9f1 (diff) | |
download | xmr-stak-83762e5bedfef2d0aa25552bc8aeae7afb8f2b5e.zip xmr-stak-83762e5bedfef2d0aa25552bc8aeae7afb8f2b5e.tar.gz |
daemon mode feature
-rw-r--r-- | cli-miner.cpp | 2 | ||||
-rw-r--r-- | config.txt | 8 | ||||
-rw-r--r-- | executor.cpp | 1 | ||||
-rw-r--r-- | executor.h | 6 | ||||
-rw-r--r-- | jconf.cpp | 8 | ||||
-rw-r--r-- | jconf.h | 2 |
6 files changed, 21 insertions, 6 deletions
diff --git a/cli-miner.cpp b/cli-miner.cpp index 2f9a635..43329e2 100644 --- a/cli-miner.cpp +++ b/cli-miner.cpp @@ -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(); @@ -140,6 +140,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
*
* output_file - This option will log all output to a file.
diff --git a/executor.cpp b/executor.cpp index af10811..383c53e 100644 --- a/executor.cpp +++ b/executor.cpp @@ -43,7 +43,6 @@ executor* executor::oInst = NULL; executor::executor() { - my_thd = nullptr; } void executor::push_timed_event(ex_event&& ev, size_t sec) @@ -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); @@ -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(); @@ -54,6 +54,8 @@ public: bool NiceHashMode(); + bool DaemonMode(); + bool PreferIpv4(); inline bool HaveHardwareAes() { return bHaveAes; } |