FreeBSD regtest: add missing helgrind expecteds
[valgrind.git] / helgrind / tests / sem_clockwait_np.c
blob65dbb8d2ddb8c3863871d194806418b46bd4c1ba
1 // this is a variation of bug484480.c using sem_clockwait_np
3 #include <pthread.h>
4 #include <semaphore.h>
5 #include <stdio.h>
6 #include <time.h>
7 #include <stdlib.h>
8 #include <string.h>
10 static char* result;
11 static sem_t sem;
13 static void* func(void* data)
15 result = "Finished!";
16 sem_post(&sem);
17 return NULL;
20 int main(void)
22 sem_init(&sem, 0, 0);
24 pthread_t tid;
25 pthread_create(&tid, NULL, func, NULL);
27 struct timespec ts = {0, 100000};
28 struct timespec ts_remain;
30 while (sem_clockwait_np(&sem, CLOCK_REALTIME, 0, &ts, &ts_remain))
31 ; // do nothing but keep retrying
33 printf("%s\n", result);
35 pthread_join(tid, NULL);