mirror of
https://github.com/MariaDB/server.git
synced 2025-01-27 17:33:44 +01:00
Rename mutex_enter_nowait to mutex_enter_nowait_func and add macro
mutex_enter_nowait that supplies the default __FILE__ and __LINE__ arguments. Adjust callers.
This commit is contained in:
parent
0a36f90086
commit
51c93813de
4 changed files with 19 additions and 13 deletions
|
@ -114,13 +114,20 @@ mutex_enter_func(
|
||||||
mutex_t* mutex, /* in: pointer to mutex */
|
mutex_t* mutex, /* in: pointer to mutex */
|
||||||
const char* file_name, /* in: file name where locked */
|
const char* file_name, /* in: file name where locked */
|
||||||
ulint line); /* in: line where locked */
|
ulint line); /* in: line where locked */
|
||||||
|
/******************************************************************
|
||||||
|
NOTE! The following macro should be used in mutex locking, not the
|
||||||
|
corresponding function. */
|
||||||
|
|
||||||
|
#define mutex_enter_nowait(M) \
|
||||||
|
mutex_enter_nowait_func((M), __FILE__, __LINE__)
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
Tries to lock the mutex for the current thread. If the lock is not acquired
|
NOTE! Use the corresponding macro in the header file, not this function
|
||||||
immediately, returns with return value 1. */
|
directly. Tries to lock the mutex for the current thread. If the lock is not
|
||||||
|
acquired immediately, returns with return value 1. */
|
||||||
|
|
||||||
ulint
|
ulint
|
||||||
mutex_enter_nowait(
|
mutex_enter_nowait_func(
|
||||||
/*===============*/
|
/*====================*/
|
||||||
/* out: 0 if succeed, 1 if not */
|
/* out: 0 if succeed, 1 if not */
|
||||||
mutex_t* mutex, /* in: pointer to mutex */
|
mutex_t* mutex, /* in: pointer to mutex */
|
||||||
const char* file_name, /* in: file name where mutex
|
const char* file_name, /* in: file name where mutex
|
||||||
|
|
|
@ -3270,7 +3270,7 @@ log_peek_lsn(
|
||||||
log system mutex */
|
log system mutex */
|
||||||
dulint* lsn) /* out: if returns TRUE, current lsn is here */
|
dulint* lsn) /* out: if returns TRUE, current lsn is here */
|
||||||
{
|
{
|
||||||
if (0 == mutex_enter_nowait(&(log_sys->mutex), __FILE__, __LINE__)) {
|
if (0 == mutex_enter_nowait(&(log_sys->mutex))) {
|
||||||
*lsn = log_sys->lsn;
|
*lsn = log_sys->lsn;
|
||||||
|
|
||||||
mutex_exit(&(log_sys->mutex));
|
mutex_exit(&(log_sys->mutex));
|
||||||
|
|
|
@ -563,8 +563,7 @@ rw_lock_debug_mutex_enter(void)
|
||||||
/*==========================*/
|
/*==========================*/
|
||||||
{
|
{
|
||||||
loop:
|
loop:
|
||||||
if (0 == mutex_enter_nowait(&rw_lock_debug_mutex,
|
if (0 == mutex_enter_nowait(&rw_lock_debug_mutex)) {
|
||||||
__FILE__, __LINE__)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -572,8 +571,7 @@ loop:
|
||||||
|
|
||||||
rw_lock_debug_waiters = TRUE;
|
rw_lock_debug_waiters = TRUE;
|
||||||
|
|
||||||
if (0 == mutex_enter_nowait(&rw_lock_debug_mutex,
|
if (0 == mutex_enter_nowait(&rw_lock_debug_mutex)) {
|
||||||
__FILE__, __LINE__)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -311,12 +311,13 @@ mutex_free(
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
Tries to lock the mutex for the current thread. If the lock is not acquired
|
NOTE! Use the corresponding macro in the header file, not this function
|
||||||
immediately, returns with return value 1. */
|
directly. Tries to lock the mutex for the current thread. If the lock is not
|
||||||
|
acquired immediately, returns with return value 1. */
|
||||||
|
|
||||||
ulint
|
ulint
|
||||||
mutex_enter_nowait(
|
mutex_enter_nowait_func(
|
||||||
/*===============*/
|
/*====================*/
|
||||||
/* out: 0 if succeed, 1 if not */
|
/* out: 0 if succeed, 1 if not */
|
||||||
mutex_t* mutex, /* in: pointer to mutex */
|
mutex_t* mutex, /* in: pointer to mutex */
|
||||||
const char* file_name __attribute__((unused)),
|
const char* file_name __attribute__((unused)),
|
||||||
|
|
Loading…
Add table
Reference in a new issue