InnoDB Plugin
1.0
|
#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_INLINE sync_array_t * | sync_array_get_and_reserve_cell (void *object, ulint type, const char *file, ulint line, ulint *index) |
UNIV_INTERN bool | 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)) |
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
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.
UNIV_INTERN void sync_array_close | ( | void | ) |
Close sync array wait sub-system.
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
arr | in: wait array |
UNIV_INTERN sync_array_t* sync_array_get | ( | void | ) |
Get an instance of the sync wait array.
UNIV_INLINE sync_array_t* sync_array_get_and_reserve_cell | ( | void * | object, |
ulint | type, | ||
const char * | file, | ||
ulint | line, | ||
ulint * | index | ||
) |
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.
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.
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 |
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
UNIV_INTERN void sync_array_object_signalled | ( | void | ) |
Note that one of the wait objects was signalled.
UNIV_INTERN void sync_array_print | ( | FILE * | file | ) |
Prints info of the wait array. in: file where to print
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 |
UNIV_INTERN bool 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.
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 |
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
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
arr | in: wait array |