> For the complete documentation index, see [llms.txt](https://kelby.gitbook.io/monero/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kelby.gitbook.io/monero/chapter1/miner.md).

# miner

```
    volatile uint32_t m_stop;
    epee::critical_section m_template_lock;
    block m_template;
    std::atomic<uint32_t> m_template_no;
    std::atomic<uint32_t> m_starter_nonce;
    difficulty_type m_diffic;
    uint64_t m_height;
    volatile uint32_t m_thread_index; 
    volatile uint32_t m_threads_total;
    std::atomic<int32_t> m_pausers_count;
    epee::critical_section m_miners_count_lock;

    std::list<boost::thread> m_threads;
    epee::critical_section m_threads_lock;
    i_miner_handler* m_phandler;
    account_public_address m_mine_address;
    epee::math_helper::once_a_time_seconds<5> m_update_block_template_interval;
    epee::math_helper::once_a_time_seconds<2> m_update_merge_hr_interval;
    std::vector<blobdata> m_extra_messages;
    miner_config m_config;
    std::string m_config_folder_path;    
    std::atomic<uint64_t> m_last_hr_merge_time;
    std::atomic<uint64_t> m_hashes;
    std::atomic<uint64_t> m_current_hash_rate;
    epee::critical_section m_last_hash_rates_lock;
    std::list<uint64_t> m_last_hash_rates;
    bool m_do_print_hashrate;
    bool m_do_mining;

    // 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;
    boost::mutex m_is_background_mining_started_mutex;
    boost::condition_variable m_is_background_mining_started_cond;    
    boost::thread m_background_mining_thread;
    uint64_t m_min_idle_seconds;
    uint8_t m_idle_threshold;
    uint8_t m_mining_target;
    std::atomic<uint64_t> m_miner_extra_sleep;
```

set\_block\_template

on\_block\_chain\_update

request\_block\_template

on\_idle

do\_print\_hashrate

merge\_hr

init\_options

init

is\_mining

get\_mining\_address

get\_threads\_count

start

get\_speed

send\_stop\_signal

stop

find\_nonce\_for\_given\_block

on\_synchronized

pause

resume

worker\_thread

get\_is\_background\_mining\_enabled

get\_ignore\_battery

set\_is\_background\_mining\_enabled

set\_ignore\_battery

get\_min\_idle\_seconds

set\_min\_idle\_seconds

get\_idle\_threshold

set\_idle\_threshold

get\_mining\_target

set\_mining\_target

background\_worker\_thread

get\_system\_times

get\_process\_time

get\_percent\_of\_total

on\_battery\_power
