CUBRID Engine
latest
|
#include <thread_waiter.hpp>
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::statset & | m_stats |
cubperf::atomic_stat_counter | m_wakeup_calls |
bool | m_was_awaken |
Definition at line 56 of file thread_waiter.hpp.
|
private |
Enumerator | |
---|---|
RUNNING | |
SLEEPING | |
AWAKENING |
Definition at line 79 of file thread_waiter.hpp.
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.
|
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().
|
inlineprivate |
Definition at line 102 of file thread_waiter.cpp.
|
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().
void cubthread::waiter::get_stats | ( | cubperf::stat_value * | stats_out | ) |
Definition at line 160 of file thread_waiter.cpp.
References cubperf::generic_stat_counter< IsAtomic >::get_count(), cubperf::statset_definition::get_stat_values_with_converted_timers(), m_stats, and m_wakeup_calls.
Referenced by cubthread::daemon::get_stats().
|
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().
|
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().
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().
|
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().
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().
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().
Definition at line 225 of file thread_waiter.cpp.
References AWAKENING, goto_sleep(), cubperf::statset_definition::increment(), m_condvar, m_mutex, m_stats, m_status, and run().
void cubthread::waiter::wakeup | ( | void | ) |
Definition at line 75 of file thread_waiter.cpp.
References awake(), cubperf::generic_stat_counter< IsAtomic >::increment(), cubperf::statset_definition::increment(), m_condvar, m_mutex, m_stats, m_status, m_wakeup_calls, and SLEEPING.
Referenced by cubthread::daemon::wakeup().
|
private |
Definition at line 92 of file thread_waiter.hpp.
Referenced by wait_for(), wait_inf(), wait_until(), and wakeup().
|
private |
Definition at line 91 of file thread_waiter.hpp.
Referenced by is_running(), wait_for(), wait_inf(), wait_until(), and wakeup().
|
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().
|
private |
Definition at line 93 of file thread_waiter.hpp.
Referenced by awake(), check_wake(), goto_sleep(), is_running(), run(), wait_for(), wait_inf(), wait_until(), and wakeup().
|
private |
Definition at line 97 of file thread_waiter.hpp.
Referenced by get_stats(), and wakeup().
|
private |
Definition at line 98 of file thread_waiter.hpp.
Referenced by awake(), goto_sleep(), and run().