diff options
author | Conrad Meyer <cem@FreeBSD.org> | 2016-06-01 16:12:26 +0000 |
---|---|---|
committer | Conrad Meyer <cem@FreeBSD.org> | 2016-06-01 16:12:26 +0000 |
commit | c72ef5eab3288a2535b264cbeabcd41944f3b80e (patch) | |
tree | 642e082d766685b4166839b0a83ba0a2a5044e0f | |
parent | a3c00561214b5760b0f54bc6f42168c891b240e5 (diff) |
Notes
-rw-r--r-- | lib/libthr/thread/thr_cond.c | 2 | ||||
-rw-r--r-- | lib/libthr/thread/thr_exit.c | 9 | ||||
-rw-r--r-- | lib/libthr/thread/thr_mutex.c | 23 |
3 files changed, 10 insertions, 24 deletions
diff --git a/lib/libthr/thread/thr_cond.c b/lib/libthr/thread/thr_cond.c index 467552b7275d..506b8eca9e7e 100644 --- a/lib/libthr/thread/thr_cond.c +++ b/lib/libthr/thread/thr_cond.c @@ -258,7 +258,7 @@ cond_wait_user(struct pthread_cond *cvp, struct pthread_mutex *mp, curthread = _get_curthread(); if (curthread->wchan != NULL) - PANIC("thread was already on queue."); + PANIC("thread %p was already on queue.", curthread); if (cancel) _thr_testcancel(curthread); diff --git a/lib/libthr/thread/thr_exit.c b/lib/libthr/thread/thr_exit.c index 6feb909fe04b..3ead7ff4eb4a 100644 --- a/lib/libthr/thread/thr_exit.c +++ b/lib/libthr/thread/thr_exit.c @@ -209,13 +209,10 @@ _pthread_exit_mask(void *status, sigset_t *mask) struct pthread *curthread = _get_curthread(); /* Check if this thread is already in the process of exiting: */ - if (curthread->cancelling) { - char msg[128]; - snprintf(msg, sizeof(msg), "Thread %p has called " + if (curthread->cancelling) + PANIC("Thread %p has called " "pthread_exit() from a destructor. POSIX 1003.1 " "1996 s16.2.5.2 does not allow this!", curthread); - PANIC(msg); - } /* Flag this thread as exiting. */ curthread->cancelling = 1; @@ -312,7 +309,7 @@ exit_thread(void) #if defined(_PTHREADS_INVARIANTS) if (THR_IN_CRITICAL(curthread)) - PANIC("thread exits with resources held!"); + PANIC("thread %p exits with resources held!", curthread); #endif /* * Kernel will do wakeup at the address, so joiner thread diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c index 2d507e79526d..5a9960591fc6 100644 --- a/lib/libthr/thread/thr_mutex.c +++ b/lib/libthr/thread/thr_mutex.c @@ -135,13 +135,9 @@ mutex_assert_is_owned(struct pthread_mutex *m __unused) { #if defined(_PTHREADS_INVARIANTS) - if (__predict_false(m->m_qe.tqe_prev == NULL)) { - char msg[128]; - snprintf(msg, sizeof(msg), - "mutex %p own %#x is not on list %p %p", + if (__predict_false(m->m_qe.tqe_prev == NULL)) + PANIC("mutex %p own %#x is not on list %p %p", m, m->m_lock.m_owner, m->m_qe.tqe_prev, m->m_qe.tqe_next); - PANIC(msg); - } #endif } @@ -152,27 +148,20 @@ mutex_assert_not_owned(struct pthread *curthread __unused, #if defined(_PTHREADS_INVARIANTS) if (__predict_false(m->m_qe.tqe_prev != NULL || - m->m_qe.tqe_next != NULL)) { - char msg[128]; - snprintf(msg, sizeof(msg), - "mutex %p own %#x is on list %p %p", + m->m_qe.tqe_next != NULL)) + PANIC("mutex %p own %#x is on list %p %p", m, m->m_lock.m_owner, m->m_qe.tqe_prev, m->m_qe.tqe_next); - PANIC(msg); - } if (__predict_false(is_robust_mutex(m) && (m->m_lock.m_rb_lnk != 0 || m->m_rb_prev != NULL || (is_pshared_mutex(m) && curthread->robust_list == (uintptr_t)&m->m_lock) || (!is_pshared_mutex(m) && curthread->priv_robust_list == - (uintptr_t)&m->m_lock)))) { - char msg[128]; - snprintf(msg, sizeof(msg), + (uintptr_t)&m->m_lock)))) + PANIC( "mutex %p own %#x is on robust linkage %p %p head %p phead %p", m, m->m_lock.m_owner, (void *)m->m_lock.m_rb_lnk, m->m_rb_prev, (void *)curthread->robust_list, (void *)curthread->priv_robust_list); - PANIC(msg); - } #endif } |