  }
  
  /*
-@@ -334,6 +363,7 @@
+@@ -334,6 +365,7 @@
  void _db_unlock(const char *file, int line, B_DB *mdb)
  {
     int errstat;

+   if (mdb->allow_transactions) { /* batch connection */
+      return;
+   }
+   if (_db_lock_jcr && _db_lock_jcr != mdb->jcr) {
+      Dmsg2(1, "ERROR: not the same jcr %p != %p", _db_lock_jcr, mdb->jcr);
+   }
+   _db_lock_recurse_count++;
+   _db_lock_jobid = mdb->jcr->JobId;
+   _db_lock_time = (utime_t) time(NULL);
+   _db_lock_threadid = pthread_self();
+}

+   char buf[128];
+   bstrutime(buf, sizeof(buf), _db_lock_time);
+
+   fprintf(stderr, "lock info: recurse_count=%i jobid=%i threadid=%i time=%s\n",
+           _db_lock_recurse_count, _db_lock_jobid, (int)_db_lock_threadid, buf);
+}
+
 /* Forward referenced functions */
 
 /* Imported functions */
Index: src/lib/message.h
===================================================================
--- src/lib/message.h	(révision 7981)
+++ src/lib/message.h	(copie de travail)
@@ -163,3 +163,14 @@
 extern DLL_IMP_EXP int           console_msg_pending;
 extern DLL_IMP_EXP FILE *        con_fd;                 /* Console file descriptor */
