]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/lockmgr.c
Cleanup attribute catalog insert errors + cancel SD only once
[bacula/bacula] / bacula / src / lib / lockmgr.c
index d035e24e8a6c56da08827a38db908adabdee4932..a790999c1d29de124bd12626bb20e028d6db5ece 100644 (file)
@@ -246,10 +246,11 @@ public:
       fprintf(fp, "threadid=%p max=%i current=%i\n", 
               (void *)thread_id, max, current);
       for(int i=0; i<=current; i++) {
-         fprintf(fp, "   lock=%p state=%c %s:%i\n", 
-               lock_list[i].lock, lock_list[i].state,
-               lock_list[i].file, lock_list[i].line);
-      }
+         fprintf(fp, "   lock=%p state=%s %s:%i\n", 
+                 lock_list[i].lock, 
+                 (lock_list[i].state=='W')?"Wanted ":"Granted",
+                 lock_list[i].file, lock_list[i].line);
+      } 
    }
 
    void dump(FILE *fp) {
@@ -353,7 +354,7 @@ class lmgr_dummy_thread_t: public lmgr_thread_t
 pthread_once_t key_lmgr_once = PTHREAD_ONCE_INIT; 
 static pthread_key_t lmgr_key;  /* used to get lgmr_thread_t object */
 
-static dlist *global_mgr=NULL;  /* used to store all lgmr_thread_t objects */
+static dlist *global_mgr = NULL;  /* used to store all lgmr_thread_t objects */
 static pthread_mutex_t lmgr_global_mutex = PTHREAD_MUTEX_INITIALIZER;
 static pthread_t undertaker;
 
@@ -553,7 +554,8 @@ void create_lmgr_key()
    lmgr_thread_t *n=NULL;
    global_mgr = New(dlist(n, &n->link));
 
-   if (pthread_create(&undertaker, NULL, check_deadlock, NULL) != 0) {
+   status = pthread_create(&undertaker, NULL, check_deadlock, NULL);
+   if (status != 0) {
       berrno be;
       Pmsg1(000, _("pthread_create failed: ERR=%s\n"),
             be.bstrerror(status));
@@ -609,7 +611,7 @@ void lmgr_cleanup_main()
    pthread_mutex_lock(&lmgr_global_mutex);
    {
       temp = global_mgr;
-      global_mgr=NULL;
+      global_mgr = NULL;
       delete temp;
    }
    pthread_mutex_unlock(&lmgr_global_mutex);