MySQL 5.6.14 Source Code Document
|
#include "univ.i"
#include "ut0lst.h"
#include "ut0mem.h"
#include "os0thread.h"
#include "sync0arr.ic"
Go to the source code of this file.
Functions | |
UNIV_INTERN void | sync_array_reserve_cell (sync_array_t *arr, void *object, ulint type, const char *file, ulint line, ulint *index) |
UNIV_INTERN void | sync_array_wait_event (sync_array_t *arr, ulint index) |
UNIV_INTERN void | sync_array_free_cell (sync_array_t *arr, ulint index) |
UNIV_INTERN void | sync_array_object_signalled (void) |
UNIV_INTERN void | sync_arr_wake_threads_if_sema_free (void) |
UNIV_INTERN ibool | sync_array_print_long_waits (os_thread_id_t *waiter, const void **sema) __attribute__((nonnull)) |
UNIV_INTERN void | sync_array_validate (sync_array_t *arr) |
UNIV_INTERN void | sync_array_print (FILE *file) |
UNIV_INTERN void | sync_array_init (ulint n_threads) |
UNIV_INTERN void | sync_array_close (void) |
UNIV_INTERN sync_array_t * | sync_array_get (void) |
The wait array used in synchronization primitives
Created 9/5/1995 Heikki Tuuri
Definition in file sync0arr.h.
UNIV_INTERN void sync_arr_wake_threads_if_sema_free | ( | void | ) |
If the wakeup algorithm does not work perfectly at semaphore relases, this function will do the waking (see the comment in mutex_exit). This function should be called about every 1 second in the server.
If the wakeup algorithm does not work perfectly at semaphore relases, this function will do the waking (see the comment in mutex_exit). 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.
Definition at line 873 of file sync0arr.cc.
UNIV_INTERN void sync_array_close | ( | void | ) |
Close sync array wait sub-system.
Definition at line 1103 of file sync0arr.cc.
UNIV_INTERN void sync_array_free_cell | ( | sync_array_t * | arr, |
ulint | index | ||
) |
Frees the cell. NOTE! sync_array_wait_event frees the cell automatically! in: index of the cell in array
Frees the cell. NOTE! sync_array_wait_event frees the cell automatically!
arr | in: wait array |
index | in: index of the cell in array |
Definition at line 785 of file sync0arr.cc.
UNIV_INTERN sync_array_t* sync_array_get | ( | void | ) |
Get an instance of the sync wait array.
Definition at line 1139 of file sync0arr.cc.
UNIV_INTERN 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
Create the primary system wait array(s), they are protected by an OS mutex
n_threads | in: Number of slots to create in all arrays |
Definition at line 1070 of file sync0arr.cc.
UNIV_INTERN void sync_array_object_signalled | ( | void | ) |
Note that one of the wait objects was signalled.
Increments the signalled count.
Definition at line 812 of file sync0arr.cc.
UNIV_INTERN void sync_array_print | ( | FILE * | file | ) |
Prints info of the wait array. in: file where to print
Print info about the sync array(s).
file | in/out: Print to this stream |
Definition at line 1120 of file sync0arr.cc.
UNIV_INTERN ibool sync_array_print_long_waits | ( | os_thread_id_t * | waiter, |
const void ** | sema | ||
) |
Prints warnings of long semaphore waits to stderr.
waiter | out: longest waiting thread |
sema | out: longest-waited-for semaphore |
Definition at line 964 of file sync0arr.cc.
UNIV_INTERN void sync_array_reserve_cell | ( | sync_array_t * | arr, |
void * | object, | ||
ulint | type, | ||
const char * | file, | ||
ulint | line, | ||
ulint * | index | ||
) |
Reserves a wait array cell for waiting for an object. The event of the cell is reset to nonsignalled state. out: index of the reserved cell
Reserves a wait array cell for waiting for an object. The event of the cell is reset to nonsignalled state.
arr | in: wait array |
object | in: pointer to the object to wait for |
type | in: lock request type |
file | in: file where requested |
line | in: line where requested |
index | out: index of the reserved cell |
Definition at line 310 of file sync0arr.cc.
UNIV_INTERN void sync_array_validate | ( | sync_array_t * | arr | ) |
Validates the integrity of the wait array. Checks that the number of reserved cells equals the count variable. in: sync wait array
Validates the integrity of the wait array. Checks that the number of reserved cells equals the count variable.
arr | in: sync wait array |
Definition at line 264 of file sync0arr.cc.
UNIV_INTERN void sync_array_wait_event | ( | sync_array_t * | arr, |
ulint | index | ||
) |
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: index of the reserved 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.
arr | in: wait array |
index | in: index of the reserved cell |
Definition at line 384 of file sync0arr.cc.