]> git.sur5r.net Git - bacula/bacula/commitdiff
Add File and Line info to rw_lock for lmgr
authorEric Bollengier <eric@eb.homelinux.org>
Mon, 29 Mar 2010 07:51:16 +0000 (09:51 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Mon, 29 Mar 2010 07:55:02 +0000 (09:55 +0200)
bacula/src/lib/rwlock.c
bacula/src/lib/rwlock.h

index d112c6822af6ce84afcc239b3daf87ea9385b0b5..c08ca7234229ac57ef10868e6493f00478616ab5 100644 (file)
@@ -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);
index a6c5c27bfa7fe27fbbd896699049ad136fcde48c..447751f9d6a71e0b2c72037785d7a3a30061202c 100644 (file)
@@ -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);