Delivers sleep and wakeup notifications. More...
#include <SleepWakeNotifier.h>

Public Member Functions | |
| SleepWakeNotifier (std::function< void()> sleep_callback, std::function< void()> wakeup_callback) | |
| Constructor. More... | |
| ~SleepWakeNotifier () | |
| Destructor Does OS-specific deregistering of sleep/wakeup notification interest and then joins m_thread. More... | |
| void | handle_sleep () |
| Called by polling thread to deliver sleep notification Calls registered sleep callback m_callback_sleep if it is not null. More... | |
| void | handle_wakeup () |
| Called by polling thread to deliver wakeup notification Calls registered wakeup callback m_callback_wakeup if it is not null. More... | |
Private Member Functions | |
| void | thread_func () |
| Thread function for event notification polling thread (m_thread) More... | |
Private Attributes | |
| std::thread | m_thread |
| Event notification polling thread. More... | |
| std::function< void()> | m_callback_sleep {} |
| Registered sleep callback. More... | |
| std::function< void()> | m_callback_wakeup {} |
| Registered wakeup callback. More... | |
Delivers sleep and wakeup notifications.
Definition at line 47 of file SleepWakeNotifier.h.
| SleepWakeNotifier::SleepWakeNotifier | ( | std::function< void()> | sleep_callback, |
| std::function< void()> | wakeup_callback | ||
| ) |
Constructor.
Creates a polling thread (m_thread) using thread_func() as the thread function. Registers sleep_callback and wakeup_callback as the sleep and wakeup callbacks, respectively.
| sleep_callback | Sleep callback |
| wakeup_callback | Wakeup callback |
Definition at line 46 of file SleepWakeNotifier.cc.
| SleepWakeNotifier::~SleepWakeNotifier | ( | ) |
Destructor Does OS-specific deregistering of sleep/wakeup notification interest and then joins m_thread.
Definition at line 148 of file SleepWakeNotifier.cc.
| void SleepWakeNotifier::handle_sleep | ( | ) |
Called by polling thread to deliver sleep notification Calls registered sleep callback m_callback_sleep if it is not null.
Definition at line 52 of file SleepWakeNotifier.cc.
| void SleepWakeNotifier::handle_wakeup | ( | ) |
Called by polling thread to deliver wakeup notification Calls registered wakeup callback m_callback_wakeup if it is not null.
Definition at line 57 of file SleepWakeNotifier.cc.
|
private |
Thread function for event notification polling thread (m_thread)
Definition at line 118 of file SleepWakeNotifier.cc.
|
private |
Registered sleep callback.
Definition at line 88 of file SleepWakeNotifier.h.
|
private |
Registered wakeup callback.
Definition at line 91 of file SleepWakeNotifier.h.
|
private |
Event notification polling thread.
Definition at line 85 of file SleepWakeNotifier.h.
1.8.8