Commit 053fec7e authored by osku's avatar osku

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.
parent 1750a977
......@@ -114,13 +114,20 @@ mutex_enter_func(
mutex_t* mutex, /* in: pointer to mutex */
const char* file_name, /* in: file name 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
immediately, returns with return value 1. */
NOTE! Use the corresponding macro in the header file, not this function
directly. Tries to lock the mutex for the current thread. If the lock is not
acquired immediately, returns with return value 1. */
ulint
mutex_enter_nowait(
/*===============*/
mutex_enter_nowait_func(
/*====================*/
/* out: 0 if succeed, 1 if not */
mutex_t* mutex, /* in: pointer to mutex */
const char* file_name, /* in: file name where mutex
......
......@@ -3270,7 +3270,7 @@ log_peek_lsn(
log system mutex */
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;
mutex_exit(&(log_sys->mutex));
......
......@@ -563,8 +563,7 @@ rw_lock_debug_mutex_enter(void)
/*==========================*/
{
loop:
if (0 == mutex_enter_nowait(&rw_lock_debug_mutex,
__FILE__, __LINE__)) {
if (0 == mutex_enter_nowait(&rw_lock_debug_mutex)) {
return;
}
......@@ -572,8 +571,7 @@ rw_lock_debug_mutex_enter(void)
rw_lock_debug_waiters = TRUE;
if (0 == mutex_enter_nowait(&rw_lock_debug_mutex,
__FILE__, __LINE__)) {
if (0 == mutex_enter_nowait(&rw_lock_debug_mutex)) {
return;
}
......
......@@ -311,12 +311,13 @@ mutex_free(
}
/************************************************************************
Tries to lock the mutex for the current thread. If the lock is not acquired
immediately, returns with return value 1. */
NOTE! Use the corresponding macro in the header file, not this function
directly. Tries to lock the mutex for the current thread. If the lock is not
acquired immediately, returns with return value 1. */
ulint
mutex_enter_nowait(
/*===============*/
mutex_enter_nowait_func(
/*====================*/
/* out: 0 if succeed, 1 if not */
mutex_t* mutex, /* in: pointer to mutex */
const char* file_name __attribute__((unused)),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment