blob: 111195bf903f8d6ba91194bfc8be60d7b12215e7 [file] [log] [blame]
sewardjb4112022007-11-09 22:49:28 +00001/* A simple race */
2
3#include <pthread.h>
4#include <unistd.h>
5
6static int shared;
7
8static void *th(void *v)
9{
10 shared++;
11
12 return 0;
13}
14
15int main()
16{
17 pthread_t a, b;
18
19 pthread_create(&a, NULL, th, NULL);
20 sleep(1); /* force ordering */
21 pthread_create(&b, NULL, th, NULL);
22
23 pthread_join(a, NULL);
24 pthread_join(b, NULL);
25
26 return 0;
27}