MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sync0arr.cc File Reference
#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"
Include dependency graph for sync0arr.cc:

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_tsync_array_get (void)

Variables

UNIV_INTERN ulong srv_sync_array_size = 32

Detailed Description

The wait array used in synchronization primitives

Created 9/5/1995 Heikki Tuuri

Definition in file sync0arr.cc.

Function Documentation

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.

Here is the caller graph for this function:

UNIV_INTERN void sync_array_close ( void  )

Close sync array wait sub-system.

Definition at line 1103 of file sync0arr.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

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!

Parameters
arrin: wait array
indexin: index of the cell in array

Definition at line 785 of file sync0arr.cc.

Here is the caller graph for this function:

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.

Here is the caller graph for this function:

UNIV_INTERN void sync_array_init ( ulint  n_threads)

Create the primary system wait array(s), they are protected by an OS mutex

Parameters
n_threadsin: Number of slots to create in all arrays

Definition at line 1070 of file sync0arr.cc.

Here is the caller graph for this function:

UNIV_INTERN void sync_array_object_signalled ( void  )

Increments the signalled count.

Definition at line 812 of file sync0arr.cc.

Here is the caller graph for this function:

UNIV_INTERN void sync_array_print ( FILE *  file)

Print info about the sync array(s).

Parameters
filein/out: Print to this stream

Definition at line 1120 of file sync0arr.cc.

Here is the caller graph for this function:

UNIV_INTERN ibool sync_array_print_long_waits ( os_thread_id_t waiter,
const void **  sema 
)

Prints warnings of long semaphore waits to stderr.

Returns
TRUE if fatal semaphore wait threshold was exceeded
Parameters
waiterout: longest waiting thread
semaout: longest-waited-for semaphore

Definition at line 964 of file sync0arr.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
arrin: wait array
objectin: pointer to the object to wait for
typein: lock request type
filein: file where requested
linein: line where requested
indexout: index of the reserved cell

Definition at line 310 of file sync0arr.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
arrin: 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.

Parameters
arrin: wait array
indexin: index of the reserved cell

Definition at line 384 of file sync0arr.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

UNIV_INTERN ulong srv_sync_array_size = 32

User configured sync array size

Definition at line 140 of file sync0arr.cc.