From 50439b0991ca4d4578f2860fd70d8ac7a4e45adc Mon Sep 17 00:00:00 2001 From: davidxu Date: Tue, 11 Dec 2007 08:00:58 +0000 Subject: Enclose all code for macro ENQUEUE_MUTEX in do while statement, and add missing brackets. MFC: after 1 day --- lib/libthr/thread/thr_mutex.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/libthr') diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c index fc233b6..105ac68 100644 --- a/lib/libthr/thread/thr_mutex.c +++ b/lib/libthr/thread/thr_mutex.c @@ -296,13 +296,15 @@ _pthread_mutex_destroy(pthread_mutex_t *mutex) #define ENQUEUE_MUTEX(curthread, m) \ - m->m_owner = curthread; \ + do { \ + (m)->m_owner = curthread; \ /* Add to the list of owned mutexes: */ \ - MUTEX_ASSERT_NOT_OWNED(m); \ - if ((m->m_lock.m_flags & UMUTEX_PRIO_PROTECT) == 0) \ - TAILQ_INSERT_TAIL(&curthread->mutexq, m, m_qe); \ + MUTEX_ASSERT_NOT_OWNED((m)); \ + if (((m)->m_lock.m_flags & UMUTEX_PRIO_PROTECT) == 0) \ + TAILQ_INSERT_TAIL(&curthread->mutexq, (m), m_qe);\ else \ - TAILQ_INSERT_TAIL(&curthread->pp_mutexq, m, m_qe) + TAILQ_INSERT_TAIL(&curthread->pp_mutexq, (m), m_qe);\ + } while (0) static int mutex_trylock_common(struct pthread *curthread, pthread_mutex_t *mutex) -- cgit v1.1