Files
ftmemsim-valgrind/helgrind/tests/race.c
Jeremy Fitzhardinge 7f7d5c5db0 Oops, forgot *.c for helgrind tests
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1938
2003-10-16 06:09:41 +00:00

28 lines
338 B
C

/* A simple race */
#include <pthread.h>
#include <unistd.h>
static int shared;
static void *th(void *v)
{
shared++;
return 0;
}
int main()
{
pthread_t a, b;
pthread_create(&a, NULL, th, NULL);
sleep(1); /* force ordering */
pthread_create(&b, NULL, th, NULL);
pthread_join(a, NULL);
pthread_join(b, NULL);
return 0;
}