MySQL 8.0.40
Source Code Documentation
|
The wait array used in synchronization primitives. More...
Go to the source code of this file.
Functions | |
static sync_array_t * | sync_array_get_and_reserve_cell (void *object, ulint type, ut::Location location, sync_cell_t **cell) |
Get an instance of the sync wait array and reserve a wait array cell in the instance for waiting for an object. More... | |
sync_cell_t * | sync_array_reserve_cell (sync_array_t *arr, void *object, ulint type, ut::Location location) |
Reserves a wait array cell for waiting for an object. More... | |
void | sync_array_wait_event (sync_array_t *arr, sync_cell_t *&cell) |
This function should be called when a thread starts to wait on a wait array cell. More... | |
void | sync_array_free_cell (sync_array_t *arr, sync_cell_t *&cell) |
Frees the cell. More... | |
void | sync_array_object_signalled () |
Note that one of the wait objects was signalled. More... | |
void | sync_arr_wake_threads_if_sema_free () |
If the wakeup algorithm does not work perfectly at semaphore releases, this function will do the waking (see the comment in mutex_exit). More... | |
bool | sync_array_print_long_waits (std::thread::id *waiter, const void **sema) |
Prints warnings of long semaphore waits to stderr. More... | |
void | sync_array_detect_deadlock () |
void | sync_array_print (FILE *file) |
Prints info of the wait array. More... | |
void | sync_array_init (ulint n_threads) |
Create the primary system wait array(s), they are protected by an OS mutex. More... | |
void | sync_array_close () |
Close sync array wait sub-system. More... | |
static sync_array_t * | sync_array_get () |
Get an instance of the sync wait array. More... | |
The wait array used in synchronization primitives.
Created 9/5/1995 Heikki Tuuri
void sync_arr_wake_threads_if_sema_free | ( | void | ) |
If the wakeup algorithm does not work perfectly at semaphore releases, this function will do the waking (see the comment in mutex_exit).
This function should be called about every 1 second in the server.
This function should be called about every 1 second in the server.
Note that there's a race condition between this thread and mutex_exit changing the lock_word and calling signal_object, so sometimes this finds threads to wake up even when nothing has gone wrong.
void sync_array_close | ( | ) |
Close sync array wait sub-system.
void sync_array_detect_deadlock | ( | ) |
void sync_array_free_cell | ( | sync_array_t * | arr, |
sync_cell_t *& | cell | ||
) |
Frees the cell.
NOTE! sync_array_wait_event frees the cell automatically! in: the reserved cell
NOTE! sync_array_wait_event frees the cell automatically!
arr | in: wait array |
cell | in/out: the cell in the array |
|
inlinestatic |
Get an instance of the sync wait array.
|
inlinestatic |
Get an instance of the sync wait array and reserve a wait array cell in the instance for waiting for an object.
The event of the cell is reset to nonsignalled state. If reserving cell of the instance fails, try to get another new instance until we can reserve an empty cell of it.
[in] | object | pointer to the object to wait for |
[in] | type | lock request type |
[in] | location | location where requested |
[out] | cell | the cell reserved, never NULL |
void sync_array_init | ( | ulint | n_threads | ) |
Create the primary system wait array(s), they are protected by an OS mutex.
in: Number of slots to create
n_threads | in: Number of slots to create in all arrays |
void sync_array_object_signalled | ( | ) |
Note that one of the wait objects was signalled.
Note that one of the wait objects was signalled.
void sync_array_print | ( | FILE * | file | ) |
Prints info of the wait array.
in: file where to print
Prints info of the wait array.
file | in/out: Print to this stream |
bool sync_array_print_long_waits | ( | std::thread::id * | waiter, |
const void ** | sema | ||
) |
Prints warnings of long semaphore waits to stderr.
waiter | out: longest waiting thread |
sema | out: longest-waited-for semaphore |
sync_cell_t * sync_array_reserve_cell | ( | sync_array_t * | arr, |
void * | object, | ||
ulint | type, | ||
ut::Location | location | ||
) |
Reserves a wait array cell for waiting for an object.
The event of the cell is reset to nonsignalled state.
[in] | arr | wait array |
[in] | object | pointer to the object to wait for |
[in] | type | lock request type |
[in] | location | location where requested |
void sync_array_wait_event | ( | sync_array_t * | arr, |
sync_cell_t *& | cell | ||
) |
This function should be called when a thread starts to wait on a wait array cell.
In the debug version this function checks if the wait for a semaphore will result in a deadlock, in which case prints info and asserts. in: the reserved cell
In the debug version this function checks if the wait for a semaphore will result in a deadlock, in which case prints info and asserts.
arr | in: wait array |
cell | in: index of the reserved cell |