FreeBSD regtest: add missing helgrind expecteds
[valgrind.git] / helgrind / tests / bug484480.c
blob8faae4bfc2d6f23e89b4cddfef6441e7a4d92f06
1 #include <pthread.h>
2 #include <semaphore.h>
3 #include <stdio.h>
5 static char* result;
6 static sem_t sem;
8 static void* func(void* data)
10 result = "Finished!";
11 sem_post(&sem);
12 return NULL;
15 int main(void)
17 sem_init(&sem, 0, 0);
19 pthread_t tid;
20 pthread_create(&tid, NULL, func, NULL);
22 while (sem_trywait(&sem))
23 ; // do nothing but keep retrying
25 /* The above loop could be replaced this instead:
26 * if (sem_trywait(&sem))
27 * sem_wait(&sem);
30 printf("%s\n", result);
32 pthread_join(tid, NULL);