summaryrefslogtreecommitdiff
path: root/tests/cancel2.c
diff options
context:
space:
mode:
authorrpj <rpj>2001-02-10 08:35:29 +0000
committerrpj <rpj>2001-02-10 08:35:29 +0000
commit1c38dfed3806cf142ebb0b1be473c88c5b2ac929 (patch)
tree0fa36b935802dfcfb1d4dfd28b3e3d791e49bc8d /tests/cancel2.c
parent1648c7a97f27d10ad302c6141562ece01065e1d7 (diff)
2001-02-09 Ross Johnson <rpj@setup1.ise.canberra.edu.au>exp-2001-02-10-passed
* nonportable.c (pthread_mutex_setdefaulttype_np): New function for changing the default mutex type. * mutex.c (ptw32_InitializeCriticalSection): Removed. (ptw32_InitializeCriticalSection): Removed. (ptw32_InitializeCriticalSection): Removed. (ptw32_InitializeCriticalSection): Removed. (ptw32_InitializeCriticalSection): Removed. (pthread_mutex_init): Apply Thomas Pfaff's original patches; remove use of critical sections and adapt for different mutex types (see log entry for 2001-01-10). The disadvantage of using critical sections is that they don't appear to be sharable between processes. This implementation provides the opportunity to place mutex objects in shared memory. Thread priority determines the order in which waiting threads acquire the mutex although the implementation includes a mechanism to prevent threads hogging the mutex through successive unlock/lock operations. (pthread_mutex_destroy): Likewise. (pthread_mutex_lock): Likewise. (pthread_mutex_unlock): Likewise. (pthread_mutex_trylock): Likewise. * pthread.h (rand_r): Add redundant test of '_seed' arg to avoid "unused variable" warnings. Any good compiler will optimise the test away anyway.
Diffstat (limited to 'tests/cancel2.c')
-rw-r--r--tests/cancel2.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/cancel2.c b/tests/cancel2.c
index 3a7c2c5..f1b5106 100644
--- a/tests/cancel2.c
+++ b/tests/cancel2.c
@@ -138,6 +138,7 @@ main()
{
int failed = 0;
int i;
+ int ret;
pthread_t t[NUMTHREADS + 1];
assert((t[0] = pthread_self()) != NULL);
@@ -155,7 +156,9 @@ main()
*/
Sleep(500);
- assert(pthread_mutex_unlock(&waitLock) == 0);
+ ret = pthread_mutex_unlock(&waitLock);
+ assert(ret != EPERM);
+ assert(ret == 0);
Sleep(500);