MySQL 5.6.14 Source Code Document
|
#include "sync0rw.h"
#include "os0thread.h"
#include "mem0mem.h"
#include "srv0srv.h"
#include "os0sync.h"
#include "ha_prototypes.h"
Go to the source code of this file.
Functions | |
UNIV_INTERN void | rw_lock_create_func (rw_lock_t *lock, const char *cfile_name, ulint cline) |
UNIV_INTERN void | rw_lock_free_func (rw_lock_t *lock) |
UNIV_INTERN void | rw_lock_s_lock_spin (rw_lock_t *lock, ulint pass, const char *file_name, ulint line) |
UNIV_INTERN void | rw_lock_x_lock_move_ownership (rw_lock_t *lock) |
UNIV_INLINE void | rw_lock_x_lock_wait (rw_lock_t *lock, const char *file_name, ulint line) |
UNIV_INLINE ibool | rw_lock_x_lock_low (rw_lock_t *lock, ulint pass, const char *file_name, ulint line) |
UNIV_INTERN void | rw_lock_x_lock_func (rw_lock_t *lock, ulint pass, const char *file_name, ulint line) |
UNIV_INTERN ibool | rw_lock_is_locked (rw_lock_t *lock, ulint lock_type) |
Variables | |
UNIV_INTERN rw_lock_stats_t | rw_lock_stats |
UNIV_INTERN rw_lock_list_t | rw_lock_list |
UNIV_INTERN ib_mutex_t | rw_lock_list_mutex |
The read-write lock (for thread synchronization)
Created 9/11/1995 Heikki Tuuri
Definition in file sync0rw.cc.
UNIV_INTERN void rw_lock_create_func | ( | rw_lock_t * | lock, |
const char * | cfile_name, | ||
ulint | cline | ||
) |
Creates, or rather, initializes an rw-lock object in a specified memory location (which must be appropriately aligned). The rw-lock is initialized to the non-locked state. Explicit freeing of the rw-lock with rw_lock_free is necessary only if the memory block containing it is freed.
lock | in: pointer to memory |
cfile_name | in: file name where created |
cline | in: file line where created |
Definition at line 209 of file sync0rw.cc.
UNIV_INTERN void rw_lock_free_func | ( | rw_lock_t * | lock | ) |
Calling this function is obligatory only if the memory buffer containing the rw-lock is freed. Removes an rw-lock object from the global list. The rw-lock is checked to be in the non-locked state.
lock | in: rw-lock |
Definition at line 285 of file sync0rw.cc.
UNIV_INTERN ibool rw_lock_is_locked | ( | rw_lock_t * | lock, |
ulint | lock_type | ||
) |
Checks if somebody has locked the rw-lock in the specified mode.
lock | in: rw-lock |
lock_type | in: lock type: RW_LOCK_SHARED, RW_LOCK_EX |
Definition at line 859 of file sync0rw.cc.
UNIV_INTERN void rw_lock_s_lock_spin | ( | rw_lock_t * | lock, |
ulint | pass, | ||
const char * | file_name, | ||
ulint | line | ||
) |
Lock an rw-lock in shared mode for the current thread. If the rw-lock is locked in exclusive mode, or there is an exclusive lock request waiting, the function spins a preset time (controlled by SYNC_SPIN_ROUNDS), waiting for the lock, before suspending the thread.
lock | in: pointer to rw-lock |
pass | in: pass value; != 0, if the lock will be passed to another thread to unlock |
file_name | in: file name where lock requested |
line | in: line where requested |
Definition at line 359 of file sync0rw.cc.
UNIV_INTERN void rw_lock_x_lock_func | ( | rw_lock_t * | lock, |
ulint | pass, | ||
const char * | file_name, | ||
ulint | line | ||
) |
NOTE! Use the corresponding macro, not directly this function! Lock an rw-lock in exclusive mode for the current thread. If the rw-lock is locked in shared or exclusive mode, or there is an exclusive lock request waiting, the function spins a preset time (controlled by SYNC_SPIN_ROUNDS), waiting for the lock before suspending the thread. If the same thread has an x-lock on the rw-lock, locking succeed, with the following exception: if pass != 0, only a single x-lock may be taken on the lock. NOTE: If the same thread has an s-lock, locking does not succeed!
< spin round count
< index of the reserved wait cell
lock | in: pointer to rw-lock |
pass | in: pass value; != 0, if the lock will be passed to another thread to unlock |
file_name | in: file name where lock requested |
line | in: line where requested |
Definition at line 599 of file sync0rw.cc.
UNIV_INLINE ibool rw_lock_x_lock_low | ( | rw_lock_t * | lock, |
ulint | pass, | ||
const char * | file_name, | ||
ulint | line | ||
) |
Low-level function for acquiring an exclusive lock.
lock | in: pointer to rw-lock |
pass | in: pass value; != 0, if the lock will be passed to another thread to unlock |
file_name | in: file name where lock requested |
line | in: line where requested |
Definition at line 535 of file sync0rw.cc.
UNIV_INTERN void rw_lock_x_lock_move_ownership | ( | rw_lock_t * | lock | ) |
This function is used in the insert buffer to move the ownership of an x-latch on a buffer frame to the current thread. The x-latch was set by the buffer read operation and it protected the buffer frame while the read was done. The ownership is moved because we want that the current thread is able to acquire a second x-latch which is stored in an mtr. This, in turn, is needed to pass the debug checks of index page operations.
lock | in: lock which was x-locked in the buffer read |
Definition at line 444 of file sync0rw.cc.
UNIV_INLINE void rw_lock_x_lock_wait | ( | rw_lock_t * | lock, |
const char * | file_name, | ||
ulint | line | ||
) |
Function for the next writer to call. Waits for readers to exit. The caller must have already decremented lock_word by X_LOCK_DECR.
lock | in: pointer to rw-lock |
file_name | in: file name where lock requested |
line | in: line where requested |
Definition at line 459 of file sync0rw.cc.
UNIV_INTERN rw_lock_stats_t rw_lock_stats |
Counters for RW locks.
Definition at line 137 of file sync0rw.cc.