Cygwin: testsuite: Update mutex tests for changed default mutex type
Default mutex type is PTHREAD_MUTEX_NORMAL. Attempting to unlock an unowned mutex of that type is specified as undefined behaviour, not returning EPERM. mutex7e verfies that attempting to unlock an unowned mutex of type PTHREAD_MUTEX_ERRORCHECK returns EPERM.
This commit is contained in:
parent
52983af631
commit
736618054c
|
@ -23,7 +23,7 @@ main()
|
||||||
{
|
{
|
||||||
assert(pthread_mutexattr_init(&mxAttr) == 0);
|
assert(pthread_mutexattr_init(&mxAttr) == 0);
|
||||||
assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0);
|
assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0);
|
||||||
assert(mxType == PTHREAD_MUTEX_ERRORCHECK);
|
assert(mxType == PTHREAD_MUTEX_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* mutex7.c
|
* mutex7.c
|
||||||
*
|
*
|
||||||
* Test the default (type not set) mutex type.
|
* Test the default (type not set) mutex type.
|
||||||
* Should be the same as PTHREAD_MUTEX_ERRORCHECK.
|
* Should be the same as PTHREAD_MUTEX_NORMAL.
|
||||||
* Thread locks then trylocks mutex (attempted recursive lock).
|
* Thread locks then trylocks mutex (attempted recursive lock).
|
||||||
* The thread should lock first time and EBUSY second time.
|
* The thread should lock first time and EBUSY second time.
|
||||||
*
|
*
|
||||||
|
@ -25,7 +25,6 @@ void * locker(void * arg)
|
||||||
assert(pthread_mutex_trylock(&mutex) == EBUSY);
|
assert(pthread_mutex_trylock(&mutex) == EBUSY);
|
||||||
lockCount++;
|
lockCount++;
|
||||||
assert(pthread_mutex_unlock(&mutex) == 0);
|
assert(pthread_mutex_unlock(&mutex) == 0);
|
||||||
assert(pthread_mutex_unlock(&mutex) == EPERM);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* mutex7d.c
|
* mutex7d.c
|
||||||
*
|
*
|
||||||
* Test the default (type not set) mutex type.
|
* Test the default (type not set) mutex type.
|
||||||
* Should be the same as PTHREAD_MUTEX_ERRORCHECK.
|
* Should be the same as PTHREAD_MUTEX_NORMAL.
|
||||||
* Thread locks then trylocks mutex (attempted recursive lock).
|
* Thread locks then trylocks mutex (attempted recursive lock).
|
||||||
* The thread should lock first time and EBUSY second time.
|
* The thread should lock first time and EBUSY second time.
|
||||||
*
|
*
|
||||||
|
@ -25,7 +25,6 @@ void * locker(void * arg)
|
||||||
assert(pthread_mutex_trylock(&mutex) == EBUSY);
|
assert(pthread_mutex_trylock(&mutex) == EBUSY);
|
||||||
lockCount++;
|
lockCount++;
|
||||||
assert(pthread_mutex_unlock(&mutex) == 0);
|
assert(pthread_mutex_unlock(&mutex) == 0);
|
||||||
assert(pthread_mutex_unlock(&mutex) == EPERM);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@ void * locker(void * arg)
|
||||||
assert(pthread_mutex_trylock(&mutex) == EBUSY);
|
assert(pthread_mutex_trylock(&mutex) == EBUSY);
|
||||||
lockCount++;
|
lockCount++;
|
||||||
assert(pthread_mutex_unlock(&mutex) == 0);
|
assert(pthread_mutex_unlock(&mutex) == 0);
|
||||||
assert(pthread_mutex_unlock(&mutex) == EPERM);
|
|
||||||
|
|
||||||
return (void *) 555;
|
return (void *) 555;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue