diff options
Diffstat (limited to 'external/unbound/testcode/checklocks.c')
-rw-r--r-- | external/unbound/testcode/checklocks.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/external/unbound/testcode/checklocks.c b/external/unbound/testcode/checklocks.c index 5815e4fd0..dab98491e 100644 --- a/external/unbound/testcode/checklocks.c +++ b/external/unbound/testcode/checklocks.c @@ -430,7 +430,7 @@ finish_acquire_lock(struct thr_check* thr, struct checked_lock* lock, * @param timedfunc: the pthread_mutex_timedlock or similar function. * Uses absolute timeout value. * @param arg: what to pass to tryfunc and timedlock. - * @param exclusive: if lock must be exlusive (only one allowed). + * @param exclusive: if lock must be exclusive (only one allowed). * @param getwr: if attempts to get writelock (or readlock) for rwlocks. */ static void @@ -502,6 +502,8 @@ void checklock_rdlock(enum check_lock_type type, struct checked_lock* lock, const char* func, const char* file, int line) { + if(key_deleted) + return; log_assert(type == check_lock_rwlock); checklock_lockit(type, lock, func, file, line, @@ -520,6 +522,8 @@ void checklock_wrlock(enum check_lock_type type, struct checked_lock* lock, const char* func, const char* file, int line) { + if(key_deleted) + return; log_assert(type == check_lock_rwlock); checklock_lockit(type, lock, func, file, line, try_wr, timed_wr, &lock->u.rwlock, 0, 1); @@ -555,6 +559,8 @@ void checklock_lock(enum check_lock_type type, struct checked_lock* lock, const char* func, const char* file, int line) { + if(key_deleted) + return; log_assert(type != check_lock_rwlock); switch(type) { case check_lock_mutex: @@ -577,8 +583,10 @@ void checklock_unlock(enum check_lock_type type, struct checked_lock* lock, const char* func, const char* file, int line) { - struct thr_check *thr = (struct thr_check*)pthread_getspecific( - thr_debug_key); + struct thr_check *thr; + if(key_deleted) + return; + thr = (struct thr_check*)pthread_getspecific(thr_debug_key); checktype(type, lock, func, file, line); if(!thr) lock_error(lock, func, file, line, "no thread info"); @@ -755,7 +763,8 @@ static void lock_debug_info(struct checked_lock* lock) { if(!lock) return; - log_info("+++ Lock %x, %d %d create %s %s %d", (int)lock, + log_info("+++ Lock %llx, %d %d create %s %s %d", + (unsigned long long)(size_t)lock, lock->create_thread, lock->create_instance, lock->create_func, lock->create_file, lock->create_line); log_info("lock type: %s", @@ -790,8 +799,9 @@ thread_debug_info(struct thr_check* thr) struct checked_lock* l = NULL; if(!thr) return; log_info("pthread id is %x", (int)thr->id); - log_info("thread func is %x", (int)thr->func); - log_info("thread arg is %x (%d)", (int)thr->arg, + log_info("thread func is %llx", (unsigned long long)(size_t)thr->func); + log_info("thread arg is %llx (%d)", + (unsigned long long)(size_t)thr->arg, (thr->arg?*(int*)thr->arg:0)); log_info("thread num is %d", thr->num); log_info("locks created %d", thr->locks_created); @@ -801,7 +811,8 @@ thread_debug_info(struct thr_check* thr) w = thr->waiting; f = thr->holding_first; l = thr->holding_last; - log_info("thread waiting for a lock: %s %x", w?"yes":"no", (int)w); + log_info("thread waiting for a lock: %s %llx", w?"yes":"no", + (unsigned long long)(size_t)w); lock_debug_info(w); log_info("thread holding first: %s, last: %s", f?"yes":"no", l?"yes":"no"); |