summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_cond.c
diff options
context:
space:
mode:
authormtm <mtm@FreeBSD.org>2003-05-21 03:41:07 +0000
committermtm <mtm@FreeBSD.org>2003-05-21 03:41:07 +0000
commit75e88124d7988922181344082558658bd36d2dad (patch)
tree80f755b7efe52046be91e342854331a75ce3c6f6 /lib/libthr/thread/thr_cond.c
parent98feca67b61085bd7f59e55486be074e6f3d0bf2 (diff)
downloadFreeBSD-src-75e88124d7988922181344082558658bd36d2dad.zip
FreeBSD-src-75e88124d7988922181344082558658bd36d2dad.tar.gz
Insert a debugging aid:
When in either the mutex or cond queue we notice that the thread is already on one of the queues, don't just simply abort(). Print out the thread's identifiers and what queue it was on. Approved by: markm/mentor, re/blanket libthr
Diffstat (limited to 'lib/libthr/thread/thr_cond.c')
-rw-r--r--lib/libthr/thread/thr_cond.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/libthr/thread/thr_cond.c b/lib/libthr/thread/thr_cond.c
index e48b121..5e26412 100644
--- a/lib/libthr/thread/thr_cond.c
+++ b/lib/libthr/thread/thr_cond.c
@@ -518,7 +518,15 @@ static void
cond_queue_enq(pthread_cond_t cond, pthread_t pthread)
{
pthread_t tid = TAILQ_LAST(&cond->c_queue, cond_head);
-
+ char *name;
+
+ name = pthread->name ? pthread->name : "unknown";
+ if ((pthread->flags & PTHREAD_FLAGS_IN_CONDQ) != 0)
+ _thread_printf(2, "Thread (%s:%u) already on condq\n",
+ pthread->name, pthread->uniqueid);
+ if ((pthread->flags & PTHREAD_FLAGS_IN_MUTEXQ) != 0)
+ _thread_printf(2, "Thread (%s:%u) already on mutexq\n",
+ pthread->name, pthread->uniqueid);
PTHREAD_ASSERT_NOT_IN_SYNCQ(pthread);
/*
OpenPOWER on IntegriCloud