| MySQL 5.6.14 Source Code Document
    | 
#include "sync0arr.h"#include "sync0sync.h"#include "sync0rw.h"#include "os0sync.h"#include "os0file.h"#include "lock0lock.h"#include "srv0srv.h"#include "ha_prototypes.h"
Go to the source code of this file.
| Classes | |
| struct | sync_cell_t | 
| struct | sync_array_t | 
| Macros | |
| #define | SYNC_ARRAY_TIMEOUT 240 | 
| Functions | |
| UNIV_INTERN void | sync_array_validate (sync_array_t *arr) | 
| 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) | 
| UNIV_INTERN void | sync_array_init (ulint n_threads) | 
| UNIV_INTERN void | sync_array_close (void) | 
| UNIV_INTERN void | sync_array_print (FILE *file) | 
| UNIV_INTERN sync_array_t * | sync_array_get (void) | 
| Variables | |
| UNIV_INTERN ulong | srv_sync_array_size = 32 | 
The wait array used in synchronization primitives
Created 9/5/1995 Heikki Tuuri
Definition in file sync0arr.cc.
| 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.
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!
| 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
| 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 | ) | 
Increments the signalled count.
Definition at line 812 of file sync0arr.cc.

| UNIV_INTERN void sync_array_print | ( | FILE * | file | ) | 
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.
| 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.
| 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.
| arr | in: wait array | 
| index | in: index of the reserved cell | 
Definition at line 384 of file sync0arr.cc.


| UNIV_INTERN ulong srv_sync_array_size = 32 | 
User configured sync array size
Definition at line 140 of file sync0arr.cc.