diff options
| author | David Xu <davidxu@FreeBSD.org> | 2007-12-11 08:00:58 +0000 |
|---|---|---|
| committer | David Xu <davidxu@FreeBSD.org> | 2007-12-11 08:00:58 +0000 |
| commit | 6a663207e7858a40398eb368e7739b656b1005a6 (patch) | |
| tree | 47a99f5e37e63c135de400a27d9ee714ecab6a0b /lib | |
| parent | f5ae94753bd4e67f3d08193d6288aaf2fbcb63a6 (diff) | |
Notes
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libthr/thread/thr_mutex.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c index fc233b61ad1d..105ac68a62de 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) |
