InnoDB Plugin  1.0
Functions
sync0sync.ic File Reference
This graph shows which files directly or indirectly include this file:

Functions

UNIV_INTERN void mutex_set_waiters (ib_mutex_t *mutex, ulint n)
UNIV_INTERN void mutex_spin_wait (ib_mutex_t *mutex, const char *file_name, ulint line)
UNIV_INTERN void mutex_set_debug_info (ib_mutex_t *mutex, const char *file_name, ulint line)
UNIV_INTERN void mutex_signal_object (ib_mutex_t *mutex)
UNIV_INLINE byte ib_mutex_test_and_set (ib_mutex_t *mutex)
UNIV_INLINE void mutex_reset_lock_word (ib_mutex_t *mutex)
UNIV_INLINE lock_word_t mutex_get_lock_word (const ib_mutex_t *mutex)
UNIV_INLINE ulint mutex_get_waiters (const ib_mutex_t *mutex)
UNIV_INLINE void mutex_exit_func (ib_mutex_t *mutex)
UNIV_INLINE void mutex_enter_func (ib_mutex_t *mutex, const char *file_name, ulint line)
UNIV_INLINE void os_atomic_dec_ulint_func (ib_mutex_t *mutex, volatile ulint *var, ulint delta)
UNIV_INLINE void os_atomic_inc_ulint_func (ib_mutex_t *mutex, volatile ulint *var, ulint delta)

Detailed Description

Mutex, the basic synchronization primitive

Created 9/5/1995 Heikki Tuuri

Function Documentation

UNIV_INLINE byte ib_mutex_test_and_set ( ib_mutex_t mutex)

Performs an atomic test-and-set instruction to the lock_word field of a mutex.

Returns
the previous value of lock_word: 0 or 1
Parameters
mutexin: mutex
UNIV_INLINE void mutex_enter_func ( ib_mutex_t mutex,
const char *  file_name,
ulint  line 
)

Locks a mutex for the current thread. If the mutex is reserved, the function spins a preset time (controlled by SYNC_SPIN_ROUNDS), waiting for the mutex before suspending the thread.

Parameters
mutexin: pointer to mutex
file_namein: file name where locked
linein: line where locked
UNIV_INLINE void mutex_exit_func ( ib_mutex_t mutex)

NOTE! Use the corresponding macro mutex_exit(), not directly this function! Unlocks a mutex owned by the current thread.

Parameters
mutexin: pointer to mutex
UNIV_INLINE lock_word_t mutex_get_lock_word ( const ib_mutex_t mutex)

Gets the value of the lock word.

Parameters
mutexin: mutex
UNIV_INLINE ulint mutex_get_waiters ( const ib_mutex_t mutex)

Gets the waiters field in a mutex.

Returns
value to set

< declared volatile to ensure that the value is read from memory

Parameters
mutexin: mutex
UNIV_INLINE void mutex_reset_lock_word ( ib_mutex_t mutex)

Performs a reset instruction to the lock_word field of a mutex. This instruction also serializes memory operations to the program order.

Parameters
mutexin: mutex
UNIV_INTERN void mutex_set_debug_info ( ib_mutex_t mutex,
const char *  file_name,
ulint  line 
)

Sets the debug information for a reserved mutex. in: line where requested

Parameters
mutexin: mutex
file_namein: file where requested
UNIV_INTERN void mutex_set_waiters ( ib_mutex_t mutex,
ulint  n 
)

Sets the waiters field in a mutex. in: value to set

Parameters
mutexin: mutex
UNIV_INTERN void mutex_signal_object ( ib_mutex_t mutex)

Releases the threads waiting in the primary wait array for this mutex. in: mutex

UNIV_INTERN void mutex_spin_wait ( ib_mutex_t mutex,
const char *  file_name,
ulint  line 
)

Reserves a mutex for the current thread. If the mutex is reserved, the function spins a preset time (controlled by SYNC_SPIN_ROUNDS) waiting for the mutex before suspending the thread. in: line where requested

Parameters
mutexin: pointer to mutex
file_namein: file name where mutex requested
UNIV_INLINE void os_atomic_dec_ulint_func ( ib_mutex_t mutex,
volatile ulint *  var,
ulint  delta 
)

Function that uses a mutex to decrement a variable atomically

Parameters
mutexin: mutex guarding the dec
varin/out: variable to decrement
deltain: delta to decrement
UNIV_INLINE void os_atomic_inc_ulint_func ( ib_mutex_t mutex,
volatile ulint *  var,
ulint  delta 
)

Function that uses a mutex to increment a variable atomically

Parameters
mutexin: mutex guarding the increment
varin/out: variable to increment
deltain: delta to increment