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
This commit is contained in:
mtm 2003-05-21 03:41:07 +00:00
parent 690445ccd6
commit 445a2987cd
2 changed files with 16 additions and 0 deletions

View File

@ -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);
/*

View File

@ -1348,7 +1348,15 @@ static inline void
mutex_queue_enq(pthread_mutex_t mutex, pthread_t pthread)
{
pthread_t tid = TAILQ_LAST(&mutex->m_queue, mutex_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);
/*
* For the common case of all threads having equal priority,