diff options
author | Dion Ahmetaj <Dion Ahmetaj> | 2017-02-15 14:00:01 -0500 |
---|---|---|
committer | Dion Ahmetaj <Dion Ahmetaj> | 2017-02-16 14:35:01 -0500 |
commit | 69ab14d91e67fdf242b00c83ab85ce280e55f6f4 (patch) | |
tree | 2f6ebdf501907f94f5cbd1f23adcbf65fad2de83 /src/cryptonote_basic/miner.h | |
parent | Merge pull request #1719 (diff) | |
download | monero-69ab14d91e67fdf242b00c83ab85ce280e55f6f4.tar.xz |
More robust battery status handling.
Added an extra path to check for linux power supply status.
Added ignore battery option. If set to true, then when we can't figure out
the power status, we'll assume the system is plugged in.
Diffstat (limited to 'src/cryptonote_basic/miner.h')
-rw-r--r-- | src/cryptonote_basic/miner.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cryptonote_basic/miner.h b/src/cryptonote_basic/miner.h index a66083ead..02987b9d9 100644 --- a/src/cryptonote_basic/miner.h +++ b/src/cryptonote_basic/miner.h @@ -31,6 +31,7 @@ #pragma once #include <boost/program_options.hpp> +#include <boost/logic/tribool_fwd.hpp> #include <atomic> #include "cryptonote_basic.h" #include "difficulty.h" @@ -67,7 +68,7 @@ namespace cryptonote static void init_options(boost::program_options::options_description& desc); bool set_block_template(const block& bl, const difficulty_type& diffic, uint64_t height); bool on_block_chain_update(); - bool start(const account_public_address& adr, size_t threads_count, const boost::thread::attributes& attrs, bool do_background = false); + bool start(const account_public_address& adr, size_t threads_count, const boost::thread::attributes& attrs, bool do_background = false, bool ignore_battery = false); uint64_t get_speed() const; uint32_t get_threads_count() const; void send_stop_signal(); @@ -82,6 +83,7 @@ namespace cryptonote void resume(); void do_print_hashrate(bool do_hr); bool get_is_background_mining_enabled() const; + bool get_ignore_battery() const; uint64_t get_min_idle_seconds() const; bool set_min_idle_seconds(uint64_t min_idle_seconds); uint8_t get_idle_threshold() const; @@ -149,8 +151,10 @@ namespace cryptonote // background mining stuffs .. bool set_is_background_mining_enabled(bool is_background_mining_enabled); + void set_ignore_battery(bool ignore_battery); bool background_worker_thread(); std::atomic<bool> m_is_background_mining_enabled; + bool m_ignore_battery; boost::mutex m_is_background_mining_enabled_mutex; boost::condition_variable m_is_background_mining_enabled_cond; std::atomic<bool> m_is_background_mining_started; @@ -164,6 +168,6 @@ namespace cryptonote static bool get_system_times(uint64_t& total_time, uint64_t& idle_time); static bool get_process_time(uint64_t& total_time); static uint8_t get_percent_of_total(uint64_t some_time, uint64_t total_time); - static bool on_battery_power(); + static boost::logic::tribool on_battery_power(); }; } |