0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Hypertable::SleepWakeNotifier Class Reference

Delivers sleep and wakeup notifications. More...

#include <SleepWakeNotifier.h>

Collaboration diagram for Hypertable::SleepWakeNotifier:
Collaboration graph
[legend]

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...
 

Detailed Description

Delivers sleep and wakeup notifications.

Definition at line 47 of file SleepWakeNotifier.h.

Constructor & Destructor Documentation

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.

Parameters
sleep_callbackSleep callback
wakeup_callbackWakeup 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.

Member Function Documentation

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.

void SleepWakeNotifier::thread_func ( )
private

Thread function for event notification polling thread (m_thread)

Definition at line 118 of file SleepWakeNotifier.cc.

Member Data Documentation

std::function<void()> Hypertable::SleepWakeNotifier::m_callback_sleep {}
private

Registered sleep callback.

Definition at line 88 of file SleepWakeNotifier.h.

std::function<void()> Hypertable::SleepWakeNotifier::m_callback_wakeup {}
private

Registered wakeup callback.

Definition at line 91 of file SleepWakeNotifier.h.

std::thread Hypertable::SleepWakeNotifier::m_thread
private

Event notification polling thread.

Definition at line 85 of file SleepWakeNotifier.h.


The documentation for this class was generated from the following files: