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:
osku 2007-01-22 09:03:59 +00:00
parent 0a36f90086
commit 51c93813de
4 changed files with 19 additions and 13 deletions

View file

@ -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

View file

@ -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));

View file

@ -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 @@ loop:
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;
}

View file

@ -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)),