MySQL 8.4.2
Source Code Documentation
|
The read-write lock (for threads) More...
#include "os0event.h"
Functions | |
void | rw_lock_s_lock_spin (rw_lock_t *lock, ulint pass, ut::Location location) |
Lock an rw-lock in shared mode for the current thread. More... | |
void | rw_lock_add_debug_info (rw_lock_t *lock, ulint pass, ulint lock_type, ut::Location location) |
Inserts the debug information for an rw-lock. More... | |
void | rw_lock_remove_debug_info (rw_lock_t *lock, ulint pass, ulint lock_type) |
Removes a debug information struct for an rw-lock. More... | |
static bool | rw_lock_get_waiters (const rw_lock_t *lock) |
Check if there are threads waiting for the rw-lock. More... | |
static void | rw_lock_set_waiter_flag (rw_lock_t *lock) |
Sets lock->waiters to true. More... | |
static void | rw_lock_reset_waiter_flag (rw_lock_t *lock) |
Resets lock->waiters to false. More... | |
static ulint | rw_lock_get_writer (const rw_lock_t *lock) |
Returns the write-status of the lock - this function made more sense with the old rw_lock implementation. More... | |
static ulint | rw_lock_get_reader_count (const rw_lock_t *lock) |
Returns the number of readers (s-locks). More... | |
static ulint | rw_lock_get_x_lock_count (const rw_lock_t *lock) |
Returns the value of writer_count for the lock. More... | |
static ulint | rw_lock_get_sx_lock_count (const rw_lock_t *lock) |
Returns the number of sx-lock for the lock. More... | |
ALWAYS_INLINE bool | rw_lock_lock_word_decr (rw_lock_t *lock, ulint amount, lint threshold) |
Two different implementations for decrementing the lock_word of a rw_lock: one for systems supporting atomic operations, one for others. More... | |
static lint | rw_lock_lock_word_incr (rw_lock_t *lock, ulint amount) |
Increments lock_word the specified amount and returns new value. More... | |
static void | rw_lock_set_writer_id_and_recursion_flag (rw_lock_t *lock, bool recursive) |
ALWAYS_INLINE bool | rw_lock_s_lock_low (rw_lock_t *lock, ulint pass, ut::Location location) |
Low-level function which tries to lock an rw-lock in s-mode. More... | |
static void | rw_lock_s_lock_func (rw_lock_t *lock, ulint pass, ut::Location location) |
NOTE! Use the corresponding macro, not directly this function! Lock an rw-lock in shared mode for the current thread. More... | |
static bool | rw_lock_x_lock_func_nowait (rw_lock_t *lock, ut::Location location) |
NOTE! Use the corresponding macro, not directly this function! Lock an rw-lock in exclusive mode for the current thread if the lock can be obtained immediately. More... | |
static void | rw_lock_s_unlock_func (ulint pass, rw_lock_t *lock) |
Releases a shared mode lock. More... | |
static void | rw_lock_x_unlock_func (ulint pass, rw_lock_t *lock) |
Releases an exclusive mode lock. More... | |
static void | rw_lock_sx_unlock_func (ulint pass, rw_lock_t *lock) |
Releases a sx mode lock. More... | |
static void | pfs_rw_lock_create_func (mysql_pfs_key_t key, rw_lock_t *lock, latch_id_t id, ut::Location clocation) |
static void | pfs_rw_lock_x_lock_func (rw_lock_t *lock, ulint pass, ut::Location location) |
Performance schema instrumented wrap function for rw_lock_x_lock_func() NOTE! Please use the corresponding macro rw_lock_x_lock(), not directly this function! More... | |
static bool | pfs_rw_lock_x_lock_func_nowait (rw_lock_t *lock, ut::Location location) |
Performance schema instrumented wrap function for rw_lock_x_lock_func_nowait() NOTE! Please use the corresponding macro rw_lock_x_lock_func(), not directly this function! More... | |
static void | pfs_rw_lock_free_func (rw_lock_t *lock) |
Performance schema instrumented wrap function for rw_lock_free_func() NOTE! Please use the corresponding macro rw_lock_free(), not directly this function! More... | |
ALWAYS_INLINE void | pfs_rw_lock_s_lock_func (rw_lock_t *lock, ulint pass, ut::Location location) |
Performance schema instrumented wrap function for rw_lock_s_lock_func() NOTE! Please use the corresponding macro rw_lock_s_lock(), not directly this function! More... | |
static void | pfs_rw_lock_sx_lock_func (rw_lock_t *lock, ulint pass, ut::Location location) |
Performance schema instrumented wrap function for rw_lock_sx_lock_func() NOTE! Please use the corresponding macro rw_lock_sx_lock(), not directly this function! More... | |
static bool | pfs_rw_lock_s_lock_low (rw_lock_t *lock, ulint pass, ut::Location location) |
static bool | pfs_rw_lock_sx_lock_low (rw_lock_t *lock, ulint pass, ut::Location location) |
Performance schema instrumented wrap function for rw_lock_sx_lock_nowait() NOTE! Please use the corresponding macro, not directly this function! More... | |
static void | pfs_rw_lock_x_unlock_func (ulint pass, rw_lock_t *lock) |
Performance schema instrumented wrap function for rw_lock_x_unlock_func() NOTE! Please use the corresponding macro rw_lock_x_unlock(), not directly this function! More... | |
static void | pfs_rw_lock_sx_unlock_func (ulint pass, rw_lock_t *lock) |
ALWAYS_INLINE void | pfs_rw_lock_s_unlock_func (ulint pass, rw_lock_t *lock) |
Performance schema instrumented wrap function for rw_lock_s_unlock_func() NOTE! Please use the corresponding macro rw_lock_s_unlock(), not directly this function! More... | |
The read-write lock (for threads)
Created 9/11/1995 Heikki Tuuri
|
inlinestatic |
|
inlinestatic |
Performance schema instrumented wrap function for rw_lock_free_func() NOTE! Please use the corresponding macro rw_lock_free(), not directly this function!
lock | in: pointer to rw-lock |
|
inline |
Performance schema instrumented wrap function for rw_lock_s_lock_func() NOTE! Please use the corresponding macro rw_lock_s_lock(), not directly this function!
[in] | lock | pointer to rw-lock |
[in] | pass | pass value; != 0, if the lock will be passed to another thread to unlock |
[in] | location | location where requested |
|
inlinestatic |
|
inline |
Performance schema instrumented wrap function for rw_lock_s_unlock_func() NOTE! Please use the corresponding macro rw_lock_s_unlock(), not directly this function!
[in] | pass | pass value; != 0, if the lock may have been passed to another thread to unlock |
[in,out] | lock | rw-lock |
|
inlinestatic |
Performance schema instrumented wrap function for rw_lock_sx_lock_func() NOTE! Please use the corresponding macro rw_lock_sx_lock(), not directly this function!
[in] | lock | pointer to rw-lock |
[in] | pass | pass value; != 0, if the lock will be passed to another thread to unlock |
[in] | location | location where requested |
|
inlinestatic |
Performance schema instrumented wrap function for rw_lock_sx_lock_nowait() NOTE! Please use the corresponding macro, not directly this function!
[in] | lock | pointer to rw-loxk |
[in] | pass | pass value; != 0 if the lock will be passed to another thread to unlock |
[in] | location | location where requested |
|
inlinestatic |
Performance schema instrumented wrap function for rw_lock_x_lock_func() NOTE! Please use the corresponding macro rw_lock_x_lock(), not directly this function!
[in] | lock | pointer to rw-lock |
[in] | pass | pass value; != 0, if the lock will be passed to another thread to unlock |
[in] | location | location where requested |
|
inlinestatic |
Performance schema instrumented wrap function for rw_lock_x_lock_func_nowait() NOTE! Please use the corresponding macro rw_lock_x_lock_func(), not directly this function!
lock | in: pointer to rw-lock |
location | in: line where requested |
Performance schema instrumented wrap function for rw_lock_x_unlock_func() NOTE! Please use the corresponding macro rw_lock_x_unlock(), not directly this function!
void rw_lock_add_debug_info | ( | rw_lock_t * | lock, |
ulint | pass, | ||
ulint | lock_type, | ||
ut::Location | location | ||
) |
Inserts the debug information for an rw-lock.
[in] | lock | rw-lock |
[in] | pass | pass value |
[in] | lock_type | lock type |
[in] | location | location where requested |
Returns the number of readers (s-locks).
lock | in: rw-lock |
Returns the number of sx-lock for the lock.
Does not reserve the lock mutex, so the caller must be sure it is not changed during the call.
lock | in: rw-lock |
|
inlinestatic |
Check if there are threads waiting for the rw-lock.
lock | in: rw-lock |
Returns the write-status of the lock - this function made more sense with the old rw_lock implementation.
lock | in: rw-lock |
Returns the value of writer_count for the lock.
Does not reserve the lock mutex, so the caller must be sure it is not changed during the call.
lock | in: rw-lock |
|
inline |
Two different implementations for decrementing the lock_word of a rw_lock: one for systems supporting atomic operations, one for others.
Decrements lock_word the specified amount if it is greater than 0.
This does does not support recursive x-locks: they should be handled by the caller and need not be atomic since they are performed by the current lock holder. Returns true if the decrement was made, false if not.
lock | in/out: rw-lock |
amount | in: amount to decrement |
threshold | in: threshold of judgement |
Increments lock_word the specified amount and returns new value.
lock | in/out: rw-lock |
amount | in: amount of increment |
Removes a debug information struct for an rw-lock.
in: lock type
lock | in: rw-lock |
pass | in: pass value |
lock_type | in: lock type |
|
inlinestatic |
Resets lock->waiters to false.
It is not an error if lock->waiters is already false.
lock | in/out: rw-lock |
|
inlinestatic |
NOTE! Use the corresponding macro, not directly this function! 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 srv_n_spin_wait_rounds), waiting for the lock, before suspending the thread.
[in] | lock | pointer to rw-lock |
[in] | pass | pass value; != 0, if the lock will be passed to another thread to unlock |
[in] | location | location where requested |
|
inline |
Low-level function which tries to lock an rw-lock in s-mode.
Performs no spinning.
[in] | lock | pointer to rw-lock |
[in] | pass | pass value; != 0, if the lock will be passed to another thread to unlock |
[in] | location | location where requested |
void rw_lock_s_lock_spin | ( | rw_lock_t * | lock, |
ulint | pass, | ||
ut::Location | location | ||
) |
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 srv_n_spin_wait_rounds), waiting for the lock before suspending the thread.
[in] | lock | pointer to rw-lock |
[in] | pass | pass value; !=0, if the lock will be passed to another thread to unlock |
[in] | location | location where requested |
Releases a shared mode lock.
[in] | pass | pass value; != 0, if the lock may have been passed to another thread to unlock |
[in,out] | lock | rw-lock |
|
inlinestatic |
Sets lock->waiters to true.
It is not an error if lock->waiters is already true.
lock | in/out: rw-lock |
|
inlinestatic |
Releases a sx mode lock.
[in] | pass | pass value; != 0, if the lock may have been passed to another thread to unlock |
[in,out] | lock | rw-lock |
|
inlinestatic |
NOTE! Use the corresponding macro, not directly this function! Lock an rw-lock in exclusive mode for the current thread if the lock can be obtained immediately.
[in] | lock | pointer to rw-lock |
[in] | location | location where requested |