2 ===================================================================
3 --- src/cats/sql.c (révision 8008)
4 +++ src/cats/sql.c (copie de travail)
9 -static void update_lock_dbg(B_DB *mdb)
11 - if (mdb->allow_transactions) { /* batch connection */
14 - if (_db_lock_recurse_count && !pthread_equal(_db_lock_threadid, pthread_self())) {
15 - Dmsg2(1, "ERROR: not the same threadif %p != %p\n", _db_lock_threadid, pthread_self());
17 - _db_lock_recurse_count++;
18 - _db_lock_time = (utime_t) time(NULL);
19 - _db_lock_threadid = pthread_self();
22 -static void update_unlock_dbg(B_DB *mdb)
24 - if (mdb->allow_transactions) { /* batch connection */
27 - if (!pthread_equal(_db_lock_threadid, pthread_self())) {
28 - Dmsg2(1, "ERROR: not the same threadid %p != %p", _db_lock_threadid, pthread_self());
30 - _db_lock_recurse_count--;
31 - if (!_db_lock_recurse_count) {
32 - memset(&_db_lock_threadid, 0, sizeof(_db_lock_threadid));
37 * Lock database, this can be called multiple times by the same
38 * thread without blocking, but must be unlocked the number of
40 e_msg(file, line, M_FATAL, 0, "rwl_writelock failure. stat=%d: ERR=%s\n",
41 errstat, be.bstrerror(errstat));
43 - update_lock_dbg(mdb);
48 void _db_unlock(const char *file, int line, B_DB *mdb)
51 - update_unlock_dbg(mdb);
52 if ((errstat=rwl_writeunlock(&mdb->lock)) != 0) {
54 e_msg(file, line, M_FATAL, 0, "rwl_writeunlock failure. stat=%d: ERR=%s\n",
55 Index: src/lib/protos.h
56 ===================================================================
57 --- src/lib/protos.h (révision 8005)
58 +++ src/lib/protos.h (copie de travail)
60 void init_signals (void terminate(int sig));
61 void init_stack_dump (void);
63 -/* Used to debug database lock
64 - * which job takes the main DB access
66 -extern DLL_IMP_EXP utime_t _db_lock_time;
67 -extern DLL_IMP_EXP int _db_lock_recurse_count;
68 -extern DLL_IMP_EXP pthread_t _db_lock_threadid;
71 void strip_leading_space (char *str);
72 void strip_trailing_junk (char *str);
73 Index: src/lib/signal.c
74 ===================================================================
75 --- src/lib/signal.c (révision 8005)
76 +++ src/lib/signal.c (copie de travail)
82 - * Global variables to get information about lock/unlock db access
84 -utime_t _db_lock_time = 0;
85 -int _db_lock_recurse_count = 0;
86 -pthread_t _db_lock_threadid;
88 -static void print_lock_dbg(FILE *fp)
91 - bstrutime(buf, sizeof(buf), _db_lock_time);
93 - fprintf(fp, "lock info: recurse_count=%i threadid=0x%x time=%s\n",
94 - _db_lock_recurse_count, (int)_db_lock_threadid, buf);
97 /* defined in jcr.c */
98 extern void _print_jcr_dbg(FILE *fp);