mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 18:13:01 +00:00
of this is to not have to link against -lrt because that causes a different back-trace on certain x86 and s390x environments. See the thread with subject "helgrind/tests/cond_timedwait_invalid failing on x86" on valgrind-developers for more details. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12246
27 lines
502 B
C
27 lines
502 B
C
|
|
#include <time.h>
|
|
#include <pthread.h>
|
|
#include <assert.h>
|
|
#include <errno.h>
|
|
|
|
int main()
|
|
{
|
|
struct timespec abstime;
|
|
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
|
|
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
|
|
|
|
|
|
|
|
|
|
abstime.tv_sec = time(NULL) + 2;
|
|
abstime.tv_nsec = 0;
|
|
|
|
abstime.tv_nsec += 1000000000;
|
|
|
|
assert(pthread_mutex_lock(&mutex)==0);
|
|
assert(pthread_cond_timedwait(&cond, &mutex, &abstime)==EINVAL);
|
|
assert(pthread_mutex_unlock(&mutex)==0);
|
|
|
|
return 0;
|
|
}
|