From: Eric Bollengier Date: Mon, 29 Mar 2010 07:51:16 +0000 (+0200) Subject: Add File and Line info to rw_lock for lmgr X-Git-Tag: Release-5.2.1~1562 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4e7e4eb5b159d73b6a466c438f829891d10ac9ed;p=bacula%2Fbacula Add File and Line info to rw_lock for lmgr --- diff --git a/bacula/src/lib/rwlock.c b/bacula/src/lib/rwlock.c index d112c6822a..c08ca72342 100644 --- a/bacula/src/lib/rwlock.c +++ b/bacula/src/lib/rwlock.c @@ -219,7 +219,7 @@ int rwl_readunlock(brwlock_t *rwl) * Lock for write access, wait until locked (or error). * Multiple nested write locking is permitted. */ -int rwl_writelock(brwlock_t *rwl) +int rwl_writelock_p(brwlock_t *rwl, const char *file, int line) { int stat; @@ -234,7 +234,7 @@ int rwl_writelock(brwlock_t *rwl) pthread_mutex_unlock(&rwl->mutex); return 0; } - lmgr_pre_lock(rwl, rwl->priority, __FILE__, __LINE__); + lmgr_pre_lock(rwl, rwl->priority, file, line); if (rwl->w_active || rwl->r_active > 0) { rwl->w_wait++; /* indicate that we are waiting */ pthread_cleanup_push(rwl_write_release, (void *)rwl); diff --git a/bacula/src/lib/rwlock.h b/bacula/src/lib/rwlock.h index a6c5c27bfa..447751f9d6 100644 --- a/bacula/src/lib/rwlock.h +++ b/bacula/src/lib/rwlock.h @@ -66,6 +66,8 @@ typedef struct s_rwsteal_tag { {PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, \ PTHREAD_COND_INITIALIZER, RWLOCK_VALID, 0, 0, 0, 0} +#define rwl_writelock(x) rwl_writelock_p((x), __FILE__, __LINE__) + /* * read/write lock prototypes */ @@ -74,7 +76,8 @@ extern int rwl_destroy(brwlock_t *rwlock); extern int rwl_readlock(brwlock_t *rwlock); extern int rwl_readtrylock(brwlock_t *rwlock); extern int rwl_readunlock(brwlock_t *rwlock); -extern int rwl_writelock(brwlock_t *rwlock); +extern int rwl_writelock_p(brwlock_t *rwlock, + const char *file="*unknown*", int line=0); extern int rwl_writetrylock(brwlock_t *rwlock); extern int rwl_writeunlock(brwlock_t *rwlock);