[PATCH] Fix __pthread_mutex_destroy
Jakub Jelinek
jakub@redhat.com
Thu Oct 5 09:35:00 GMT 2000
Hi!
After reading a few times spinlock.[ch] and mutex.c, I believe dtc's patch
is correct. Can you apply it?
Thanks.
2000-10-05 Jakub Jelinek <jakub@redhat.com>
* mutex.c (__pthread_mutex_destroy): Correct test of
busy mutex for mutexes using alternate fastlocks.
Patch by dtc@cmucl.cons.org.
--- libc/linuxthreads/mutex.c.jj Fri Sep 29 12:56:56 2000
+++ libc/linuxthreads/mutex.c Thu Oct 5 18:30:08 2000
@@ -38,8 +38,20 @@ strong_alias (__pthread_mutex_init, pthr
int __pthread_mutex_destroy(pthread_mutex_t * mutex)
{
- if ((mutex->__m_lock.__status & 1) != 0) return EBUSY;
- return 0;
+ switch (mutex->__m_kind) {
+ case PTHREAD_MUTEX_ADAPTIVE_NP:
+ case PTHREAD_MUTEX_RECURSIVE_NP:
+ if ((mutex->__m_lock.__status & 1) != 0)
+ return EBUSY;
+ return 0;
+ case PTHREAD_MUTEX_ERRORCHECK_NP:
+ case PTHREAD_MUTEX_TIMED_NP:
+ if (mutex->__m_lock.__status != 0)
+ return EBUSY;
+ return 0;
+ default:
+ return EINVAL;
+ }
}
strong_alias (__pthread_mutex_destroy, pthread_mutex_destroy)
Jakub
More information about the Libc-hacker
mailing list