InnoDB condition variable.
More...
|
void | init () 1 |
| Initialize a condition variable. More...
|
|
void | wait () 1 |
| Wait on condition variable. More...
|
|
void | broadcast () 1 |
| Wakes all threads waiting for condition variable. More...
|
|
void | signal () 1 |
| Wakes one thread waiting for condition variable. More...
|
|
bool | timed_wait (const timespec *abstime) |
| Do a timed wait on condition variable. More...
|
|
struct timespec | get_wait_timelimit (std::chrono::microseconds timeout) |
| Returns absolute time until which we should wait if we wanted to wait for timeout since now. More...
|
|
InnoDB condition variable.
◆ os_event() [1/2]
◆ ~os_event()
◆ os_event() [2/2]
◆ broadcast()
void os_event::broadcast |
( |
| ) |
|
|
inlineprivate |
Wakes all threads waiting for condition variable.
◆ destroy()
void os_event::destroy |
( |
| ) |
|
|
inline |
Destroys a condition variable.
◆ get_wait_timelimit()
struct timespec os_event::get_wait_timelimit |
( |
std::chrono::microseconds |
timeout | ) |
|
|
private |
Returns absolute time until which we should wait if we wanted to wait for timeout since now.
This method could be removed if we switched to the usage of std::condition_variable.
◆ init()
void os_event::init |
( |
void |
| ) |
|
|
inlineprivate |
Initialize a condition variable.
◆ is_set()
bool os_event::is_set |
( |
| ) |
const |
|
inline |
- Returns
- true if the event is in the signalled state.
◆ operator=()
◆ reset()
int64_t os_event::reset |
( |
void |
| ) |
|
|
inline |
◆ set()
◆ signal()
void os_event::signal |
( |
| ) |
|
|
inlineprivate |
Wakes one thread waiting for condition variable.
◆ timed_wait()
bool os_event::timed_wait |
( |
const timespec * |
abstime | ) |
|
|
private |
Do a timed wait on condition variable.
- Returns
- true if timed out, false otherwise
- Parameters
-
◆ try_set()
bool os_event::try_set |
( |
| ) |
|
|
inline |
◆ wait()
Wait on condition variable.
◆ wait_low()
void os_event::wait_low |
( |
int64_t |
reset_sig_count | ) |
|
Waits for an event object until it is in the signaled state.
Typically, if the event has been signalled after the os_event_reset() we'll return immediately because event->m_set == true. There are, however, situations (e.g.: sync_array code) where we may lose this information. For example:
thread A calls os_event_reset() thread B calls os_event_set() [event->m_set == true] thread C calls os_event_reset() [event->m_set == false] thread A calls os_event_wait() [infinite wait!] thread C calls os_event_wait() [infinite wait!]
Where such a scenario is possible, to avoid infinite wait, the value returned by reset() should be passed in as reset_sig_count.
◆ wait_time_low()
ulint os_event::wait_time_low |
( |
std::chrono::microseconds |
timeout, |
|
|
int64_t |
reset_sig_count |
|
) |
| |
Waits for an event object until it is in the signaled state or a timeout is exceeded.
- Parameters
-
timeout | Timeout in microseconds, or std::chrono::microseconds::max() |
reset_sig_count | Zero or the value returned by previous call of os_event_reset(). |
- Returns
- 0 if success, OS_SYNC_TIME_EXCEEDED if timeout was exceeded
◆ os_event_global_destroy
void os_event_global_destroy |
( |
void |
| ) |
|
|
friend |
Deinitializes support for os_event objects.
Must be called once, and after all os_event objects are destroyed. After it is called, no new os_event is allowed to be created.
◆ os_event_global_init
void os_event_global_init |
( |
void |
| ) |
|
|
friend |
Initializes support for os_event objects.
Must be called once, and before any os_event object is created.
◆ cond_attr
pthread_condattr_t os_event::cond_attr |
|
staticprivate |
Attributes object passed to pthread_cond_* functions.
Defines usage of the monotonic clock if it's available. Initialized once, in the os_event::global_init(), and destroyed in the os_event::global_destroy().
◆ cond_attr_has_monotonic_clock
bool os_event::cond_attr_has_monotonic_clock {false} |
|
staticprivate |
True iff usage of the monotonic clock has been successfully enabled for the cond_attr object.
◆ cond_var
condition variable is used in waiting for the event
◆ global_initialized
bool os_event::global_initialized {false} |
|
staticprivate |
◆ m_set
this is true when the event is in the signaled state, i.e., a thread does not stop if it tries to wait for this event
◆ mutex
this mutex protects the next fields
◆ n_objects_alive
std::atomic_size_t os_event::n_objects_alive {0} |
|
staticprivate |
◆ signal_count
int64_t os_event::signal_count |
|
private |
this is incremented each time the event becomes signaled
The documentation for this struct was generated from the following file: