]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/lockmgr.h
Cleanup attribute catalog insert errors + cancel SD only once
[bacula/bacula] / bacula / src / lib / lockmgr.h
index 83d9b3c879bf0ed73fd95c9300b94dc6075515ed..697b84483826ce8da3caa237dbff40982a62f7e4 100644 (file)
@@ -47,7 +47,8 @@ void lmgr_v(pthread_mutex_t *m);
 
 /* Not yet working */
 int lmgr_cond_wait(pthread_cond_t *cond,
-                   pthread_mutex_t *mutex);
+                   pthread_mutex_t *mutex,
+                   const char *file="*unknown*", int line=0);
 
 /* Replacement of pthread_mutex_lock() */
 int lmgr_mutex_lock(pthread_mutex_t *m, 
@@ -60,10 +61,18 @@ int lmgr_mutex_unlock(pthread_mutex_t *m,
 /* 
  * Use them when you want use your lock yourself (ie rwlock)
  */
-void lmgr_pre_lock(void *m);    /* Call before requesting the lock */
-void lmgr_post_lock();          /* Call after getting it */
-void lmgr_do_lock(void *m);     /* Same as pre+post lock */
-void lmgr_do_unlock(void *m);   /* Call just before releasing the lock */
+
+/* Call before requesting the lock */
+void lmgr_pre_lock(void *m, const char *file="*unknown*", int line=0);
+
+/* Call after getting it */ 
+void lmgr_post_lock();
+
+/* Same as pre+post lock */
+void lmgr_do_lock(void *m, const char *file="*unknown*", int line=0);
+
+/* Call just before releasing the lock */
+void lmgr_do_unlock(void *m); 
 
 /*
  * Each thread have to call this function to put a lmgr_thread_t object
@@ -119,7 +128,7 @@ int lmgr_thread_create(pthread_t *thread,
 # define V(x) lmgr_mutex_unlock(&(x), __FILE__, __LINE__)
 # define pthread_mutex_lock(x)       lmgr_mutex_lock(x, __FILE__, __LINE__)
 # define pthread_mutex_unlock(x)     lmgr_mutex_unlock(x, __FILE__, __LINE__)
-# define pthread_cond_wait(x,y)      lmgr_cond_wait(x,y)
+# define pthread_cond_wait(x,y)      lmgr_cond_wait(x,y, __FILE__, __LINE__)
 # define pthread_create(a, b, c, d)  lmgr_thread_create(a,b,c,d)
 #endif
 
@@ -129,9 +138,9 @@ int lmgr_thread_create(pthread_t *thread,
 # define lmgr_dump()
 # define lmgr_init_thread()
 # define lmgr_cleanup_thread()
-# define lmgr_pre_lock(m)
+# define lmgr_pre_lock(m, f, l)
 # define lmgr_post_lock()
-# define lmgr_do_lock(m)
+# define lmgr_do_lock(m, f, l)
 # define lmgr_do_unlock(m)
 # define lmgr_cleanup_main()
 # define P(x) lmgr_p(&(x))