28 #ifndef Hypertable_Common_SleepWakeNotifier_h
29 #define Hypertable_Common_SleepWakeNotifier_h
36 #if defined(__APPLE__)
37 #include <IOKit/pwr_mgt/IOPMLib.h>
59 std::function<
void()> wakeup_callback);
74 #if defined(__APPLE__)
75 io_connect_t get_root_port() {
return m_root_port; }
93 #if defined(__APPLE__)
94 io_connect_t m_root_port;
98 IONotificationPortRef m_notify_port_ref;
101 io_object_t m_notifier_object;
104 CFRunLoopRef m_run_loop;
113 #endif // Hypertable_Common_SleepWakeNotifier_h
Delivers sleep and wakeup notifications.
SleepWakeNotifier(std::function< void()> sleep_callback, std::function< void()> wakeup_callback)
Constructor.
std::thread m_thread
Event notification polling thread.
~SleepWakeNotifier()
Destructor Does OS-specific deregistering of sleep/wakeup notification interest and then joins m_thre...
std::function< void()> m_callback_sleep
Registered sleep callback.
void thread_func()
Thread function for event notification polling thread (m_thread)
void handle_sleep()
Called by polling thread to deliver sleep notification Calls registered sleep callback m_callback_sle...
std::function< void()> m_callback_wakeup
Registered wakeup callback.
A String class based on std::string.
void handle_wakeup()
Called by polling thread to deliver wakeup notification Calls registered wakeup callback m_callback_w...