MySQL 8.0.39
Source Code Documentation
|
The interface to the operating system condition variables. More...
Go to the source code of this file.
Typedefs | |
typedef struct os_event * | os_event_t |
Functions | |
os_event_t | os_event_create () |
Creates an event semaphore, i.e., a semaphore which may just have two states: signaled and nonsignaled. More... | |
void | os_event_set (os_event_t event) |
Sets an event semaphore to the signaled state: lets waiting threads proceed. More... | |
bool | os_event_try_set (os_event_t event) |
bool | os_event_is_set (const os_event_t event) |
Check if the event is set. More... | |
int64_t | os_event_reset (os_event_t event) |
Resets an event semaphore to the non-signaled state. More... | |
void | os_event_destroy (os_event_t &event) |
Frees an event object. More... | |
void | os_event_wait_low (os_event_t event, int64_t reset_sig_count) |
Waits for an event object until it is in the signaled state. More... | |
static void | os_event_wait (os_event_t e) |
Blocking infinite wait on an event, until signalled. More... | |
ulint | os_event_wait_time_low (os_event_t event, 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. More... | |
static ulint | os_event_wait_time (os_event_t e, std::chrono::microseconds t) |
Blocking timed wait on an event. More... | |
void | os_event_global_init (void) |
Initializes support for os_event objects. More... | |
void | os_event_global_destroy (void) |
Deinitializes support for os_event objects. More... | |
Variables | |
constexpr uint32_t | OS_SYNC_TIME_EXCEEDED = 1 |
Return value of os_event_wait_time() when the time is exceeded. More... | |
The interface to the operating system condition variables.
Created 2012-09-23 Sunny Bains (split from os0sync.h)
typedef struct os_event* os_event_t |
os_event_t os_event_create | ( | ) |
Creates an event semaphore, i.e., a semaphore which may just have two states: signaled and nonsignaled.
The created event is manual reset: it must be reset explicitly by calling os_event_reset().
The created event is manual reset: it must be reset explicitly by calling sync_os_reset_event.
On SuSE Linux we get spurious EBUSY from pthread_mutex_destroy() unless we grab and release the mutex here. Current OS version: openSUSE Leap 15.0 Linux xxx 4.12.14-lp150.12.25-default #1 SMP Thu Nov 1 06:14:23 UTC 2018 (3fcf457) x86_64 x86_64 x86_64 GNU/Linux
void os_event_destroy | ( | os_event_t & | event | ) |
Frees an event object.
in/own: event to free
event | in/own: event to free |
void os_event_global_destroy | ( | void | ) |
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.
void os_event_global_init | ( | void | ) |
Initializes support for os_event objects.
Must be called once, and before any os_event object is created.
bool os_event_is_set | ( | const os_event_t | event | ) |
Check if the event is set.
event | in: event to test |
int64_t os_event_reset | ( | os_event_t | event | ) |
Resets an event semaphore to the non-signaled state.
Waiting threads will stop to wait for the event. The return value should be passed to os_even_wait_low() if it is desired that this thread should not wait in case of an intervening call to os_event_set() between this os_event_reset() and the os_event_wait_low() call. See comments for os_event_wait_low(). in/out: event to reset
Resets an event semaphore to the non-signaled state.
Waiting threads will stop to wait for the event. The return value should be passed to os_even_wait_low() if it is desired that this thread should not wait in case of an intervening call to os_event_set() between this os_event_reset() and the os_event_wait_low() call. See comments for os_event_wait_low().
event | in/out: event to reset |
void os_event_set | ( | os_event_t | event | ) |
Sets an event semaphore to the signaled state: lets waiting threads proceed.
in/out: event to set
event | in/out: event to set |
bool os_event_try_set | ( | os_event_t | event | ) |
|
inlinestatic |
Blocking infinite wait on an event, until signalled.
e | - event to wait on. |
void os_event_wait_low | ( | os_event_t | event, |
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->is_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->is_set == true] thread C calls os_event_reset() [event->is_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 os_event_reset() should be passed in as reset_sig_count. in: zero or the value returned by previous call of os_event_reset().
Where such a scenario is possible, to avoid infinite wait, the value returned by os_event_reset() should be passed in as reset_sig_count.
event | in: event to wait |
reset_sig_count | in: zero or the value returned by previous call of os_event_reset(). |
|
inlinestatic |
Blocking timed wait on an event.
e | - event to wait on. |
t | - timeout |
ulint os_event_wait_time_low | ( | os_event_t | event, |
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.
In Unix the timeout is always infinite.
[in,out] | event | Event to wait for. |
[in] | timeout | Timeout, or std::chrono::microseconds::max(). |
[in] | reset_sig_count | Zero or the value returned by previous call of os_event_reset(). |
|
constexpr |
Return value of os_event_wait_time() when the time is exceeded.