CUBRID Engine  latest
cubthread::waiter Class Reference

#include <thread_waiter.hpp>

Collaboration diagram for cubthread::waiter:
Collaboration graph

Public Member Functions

 waiter ()
 
 ~waiter ()
 
void wakeup (void)
 
void wait_inf (void)
 
bool wait_for (const std::chrono::system_clock::duration &delta)
 
bool wait_until (const std::chrono::system_clock::time_point &timeout_time)
 
void get_stats (cubperf::stat_value *stats_out)
 
bool is_running ()
 

Static Public Member Functions

static std::size_t get_stats_value_count (void)
 
static const char * get_stat_name (std::size_t stat_index)
 

Private Types

enum  status { RUNNING, SLEEPING, AWAKENING }
 

Private Member Functions

bool check_wake (void)
 
void goto_sleep (void)
 
void awake (void)
 
void run (void)
 

Private Attributes

std::mutex m_mutex
 
std::condition_variable m_condvar
 
status m_status
 
cubperf::statsetm_stats
 
cubperf::atomic_stat_counter m_wakeup_calls
 
bool m_was_awaken
 

Detailed Description

Definition at line 56 of file thread_waiter.hpp.

Member Enumeration Documentation

Enumerator
RUNNING 
SLEEPING 
AWAKENING 

Definition at line 79 of file thread_waiter.hpp.

Constructor & Destructor Documentation

cubthread::waiter::waiter ( )

Definition at line 59 of file thread_waiter.cpp.

cubthread::waiter::~waiter ( )

Definition at line 69 of file thread_waiter.cpp.

References m_stats.

Member Function Documentation

void cubthread::waiter::awake ( void  )
inlineprivate

Definition at line 120 of file thread_waiter.cpp.

References assert, AWAKENING, m_stats, m_status, cubperf::generic_statset< IsAtomic >::m_timept, m_was_awaken, cubperf::reset_timept(), and SLEEPING.

Referenced by wakeup().

Here is the caller graph for this function:

bool cubthread::waiter::check_wake ( void  )
inlineprivate

Definition at line 102 of file thread_waiter.cpp.

References AWAKENING, and m_status.

const char * cubthread::waiter::get_stat_name ( std::size_t  stat_index)
static

Definition at line 184 of file thread_waiter.cpp.

References assert, get_stats_value_count(), cubperf::statset_definition::get_value_name(), and cubthread::STAT_WAKEUP_CALL_COUNT_NAME.

Referenced by cubthread::daemon::get_stat_name().

Here is the caller graph for this function:

void cubthread::waiter::get_stats ( cubperf::stat_value stats_out)
std::size_t cubthread::waiter::get_stats_value_count ( void  )
static

Definition at line 167 of file thread_waiter.cpp.

References cubperf::statset_definition::get_value_count().

Referenced by get_stat_name(), cubthread::daemon::get_stat_name(), and cubthread::daemon::get_stats_value_count().

Here is the caller graph for this function:

void cubthread::waiter::goto_sleep ( void  )
private

Definition at line 108 of file thread_waiter.cpp.

References assert, cubperf::statset_definition::increment(), m_stats, m_status, m_was_awaken, RUNNING, and SLEEPING.

Referenced by wait_for(), wait_inf(), and wait_until().

Here is the caller graph for this function:

bool cubthread::waiter::is_running ( void  )

Definition at line 176 of file thread_waiter.cpp.

References m_mutex, m_status, and RUNNING.

Referenced by cubthread::daemon::is_running().

Here is the caller graph for this function:

void cubthread::waiter::run ( void  )
private

Definition at line 132 of file thread_waiter.cpp.

References assert, AWAKENING, m_stats, m_status, m_was_awaken, RUNNING, SLEEPING, and cubperf::statset_definition::time_and_increment().

Referenced by wait_for(), wait_inf(), and wait_until().

Here is the caller graph for this function:

bool cubthread::waiter::wait_for ( const std::chrono::system_clock::duration &  delta)

Definition at line 199 of file thread_waiter.cpp.

References AWAKENING, goto_sleep(), cubperf::statset_definition::increment(), m_condvar, m_mutex, m_stats, m_status, and run().

Referenced by cubthread::looper::put_to_sleep().

Here is the caller graph for this function:

void cubthread::waiter::wait_inf ( void  )

Definition at line 146 of file thread_waiter.cpp.

References AWAKENING, goto_sleep(), m_condvar, m_mutex, m_status, and run().

Referenced by cubthread::looper::put_to_sleep().

Here is the caller graph for this function:

bool cubthread::waiter::wait_until ( const std::chrono::system_clock::time_point &  timeout_time)
void cubthread::waiter::wakeup ( void  )

Member Data Documentation

std::condition_variable cubthread::waiter::m_condvar
private

Definition at line 92 of file thread_waiter.hpp.

Referenced by wait_for(), wait_inf(), wait_until(), and wakeup().

std::mutex cubthread::waiter::m_mutex
private

Definition at line 91 of file thread_waiter.hpp.

Referenced by is_running(), wait_for(), wait_inf(), wait_until(), and wakeup().

cubperf::statset& cubthread::waiter::m_stats
private

Definition at line 96 of file thread_waiter.hpp.

Referenced by awake(), get_stats(), goto_sleep(), run(), wait_for(), wait_until(), wakeup(), and ~waiter().

status cubthread::waiter::m_status
private
cubperf::atomic_stat_counter cubthread::waiter::m_wakeup_calls
private

Definition at line 97 of file thread_waiter.hpp.

Referenced by get_stats(), and wakeup().

bool cubthread::waiter::m_was_awaken
private

Definition at line 98 of file thread_waiter.hpp.

Referenced by awake(), goto_sleep(), and run().


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