diff options
author | 2001-11-12 21:13:34 +0000 | |
---|---|---|
committer | 2001-11-12 21:13:34 +0000 | |
commit | c2d1211041f84332ab0c02ddea9f8f10884e3bb1 (patch) | |
tree | e601e4f5974f6a7d6fbbf65d58aa8b54301dae5a /lib/libpthread/uthread | |
parent | Make MAXTIME overrideable. (diff) | |
download | wireguard-openbsd-c2d1211041f84332ab0c02ddea9f8f10884e3bb1.tar.xz wireguard-openbsd-c2d1211041f84332ab0c02ddea9f8f10884e3bb1.zip |
a better fix for recursive mutex.
Diffstat (limited to 'lib/libpthread/uthread')
-rw-r--r-- | lib/libpthread/uthread/uthread_mutex.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/lib/libpthread/uthread/uthread_mutex.c b/lib/libpthread/uthread/uthread_mutex.c index 4fc3962fa83..25a56da6680 100644 --- a/lib/libpthread/uthread/uthread_mutex.c +++ b/lib/libpthread/uthread/uthread_mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_mutex.c,v 1.12 2001/11/12 02:24:30 marc Exp $ */ +/* $OpenBSD: uthread_mutex.c,v 1.13 2001/11/12 21:13:34 fgsch Exp $ */ /* * Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>. * All rights reserved. @@ -438,10 +438,6 @@ pthread_mutex_lock(pthread_mutex_t * mutex) /* Lock the mutex for this thread: */ (*mutex)->m_owner = _thread_run; - /* if recursive, increment the lock count */ - if ((*mutex)->m_type == PTHREAD_MUTEX_RECURSIVE) - (*mutex)->m_data.m_count++; - /* Add to the list of owned mutexes: */ _MUTEX_ASSERT_NOT_OWNED(*mutex); TAILQ_INSERT_TAIL(&_thread_run->mutexq, @@ -481,10 +477,6 @@ pthread_mutex_lock(pthread_mutex_t * mutex) /* Lock the mutex for this thread: */ (*mutex)->m_owner = _thread_run; - /* if recursive, increment the lock count */ - if ((*mutex)->m_type == PTHREAD_MUTEX_RECURSIVE) - (*mutex)->m_data.m_count++; - /* Track number of priority mutexes owned: */ _thread_run->priority_mutex_count++; @@ -549,10 +541,6 @@ pthread_mutex_lock(pthread_mutex_t * mutex) */ (*mutex)->m_owner = _thread_run; - /* if recursive, increment the lock count */ - if ((*mutex)->m_type == PTHREAD_MUTEX_RECURSIVE) - (*mutex)->m_data.m_count++; - /* Track number of priority mutexes owned: */ _thread_run->priority_mutex_count++; @@ -751,7 +739,7 @@ mutex_unlock_common(pthread_mutex_t * mutex, int add_reference) ret = EPERM; } else if (((*mutex)->m_type == PTHREAD_MUTEX_RECURSIVE) && - ((*mutex)->m_data.m_count > 1)) { + ((*mutex)->m_data.m_count > 0)) { /* Decrement the count: */ (*mutex)->m_data.m_count--; } else { @@ -810,7 +798,7 @@ mutex_unlock_common(pthread_mutex_t * mutex, int add_reference) ret = EPERM; } else if (((*mutex)->m_type == PTHREAD_MUTEX_RECURSIVE) && - ((*mutex)->m_data.m_count > 1)) { + ((*mutex)->m_data.m_count > 0)) { /* Decrement the count: */ (*mutex)->m_data.m_count--; } else { @@ -919,7 +907,7 @@ mutex_unlock_common(pthread_mutex_t * mutex, int add_reference) ret = EPERM; } else if (((*mutex)->m_type == PTHREAD_MUTEX_RECURSIVE) && - ((*mutex)->m_data.m_count > 1)) { + ((*mutex)->m_data.m_count > 0)) { /* Decrement the count: */ (*mutex)->m_data.m_count--; } else { |