From 30a1e9738593302fa26e0a668f517bc7f5800190 Mon Sep 17 00:00:00 2001 From: rpj Date: Sun, 13 Jan 2002 02:29:40 +0000 Subject: * attr.c (pthread_attr_setscope): Fix struct pointer indirection error introduced 2002-01-04. (pthread_attr_getscope): Likewise. * pthread.dsp (SOURCE): Add missing source files. ./tests/: * exception3.c (main): Shorten wait time. * mutex7.c: New test. * mutex7n.c: New test. * mutex7e.c: New test. * mutex7r.c: New test. * mutex6.c: Modified to avoid leaving the locked mutex around on exit. --- tests/mutex6n.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'tests/mutex6n.c') diff --git a/tests/mutex6n.c b/tests/mutex6n.c index d982c4c..e006f24 100644 --- a/tests/mutex6n.c +++ b/tests/mutex6n.c @@ -49,10 +49,11 @@ void * locker(void * arg) { assert(pthread_mutex_lock(&mutex) == 0); lockCount++; - assert(pthread_mutex_lock(&mutex) != 0); + + /* Should wait here (deadlocked) */ + assert(pthread_mutex_lock(&mutex) == 0); lockCount++; assert(pthread_mutex_unlock(&mutex) == 0); - assert(pthread_mutex_unlock(&mutex) == 0); return (void *) 555; } @@ -76,6 +77,16 @@ main() assert(lockCount == 1); + /* + * Should succeed even though we don't own the lock + * because FAST mutexes don't check ownership. + */ + assert(pthread_mutex_unlock(&mutex) == 0); + + Sleep (1000); + + assert(lockCount == 2); + exit(0); /* Never reached */ -- cgit v1.2.3