diff options
Diffstat (limited to 'src/thread/pthread_mutex_unlock.c')
-rw-r--r-- | src/thread/pthread_mutex_unlock.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/thread/pthread_mutex_unlock.c b/src/thread/pthread_mutex_unlock.c index 769d6e56..b4ed3f87 100644 --- a/src/thread/pthread_mutex_unlock.c +++ b/src/thread/pthread_mutex_unlock.c @@ -8,7 +8,6 @@ int pthread_mutex_unlock(pthread_mutex_t *m) pthread_t self; int waiters = m->_m_waiters; int cont; - int robust = 0; int type = m->_m_type & 15; int priv = (m->_m_type & 128) ^ 128; @@ -16,20 +15,19 @@ int pthread_mutex_unlock(pthread_mutex_t *m) if (!m->_m_lock) return EPERM; self = __pthread_self(); - if ((m->_m_lock&0x1fffffff) != self->tid) + if ((m->_m_lock&0x7fffffff) != self->tid) return EPERM; if ((type&3) == PTHREAD_MUTEX_RECURSIVE && m->_m_count) return m->_m_count--, 0; - if (type >= 4) { - robust = 1; + if (!priv) { self->robust_list.pending = &m->_m_next; - *(void **)m->_m_prev = m->_m_next; - if (m->_m_next) ((void **)m->_m_next)[-1] = m->_m_prev; __vm_lock_impl(+1); } + *(void **)m->_m_prev = m->_m_next; + if (m->_m_next) ((void **)m->_m_next)[-1] = m->_m_prev; } cont = a_swap(&m->_m_lock, 0); - if (robust) { + if (type != PTHREAD_MUTEX_NORMAL && !priv) { self->robust_list.pending = 0; __vm_unlock_impl(); } |