blob: de01f2c490b5f877771ec5281692eb9eceef8d53 [file] [log] [blame]
sewardjb4112022007-11-09 22:49:28 +00001/* A simple race - test symaddr */
2
3#include <pthread.h>
4#include <unistd.h>
5
6struct foo {
7 struct bar {
8 int plop[22];
9 char biff;
10 } poot[11];
11};
12
13static void *th(void *v)
14{
15 struct foo *f = (struct foo *)v;
16
17 f->poot[5].plop[11]++;
18
19 return 0;
20}
21
22int main()
23{
24 struct foo foo;
25 pthread_t a, b;
26
27 pthread_create(&a, NULL, th, &foo);
28 sleep(1); /* force ordering */
29 pthread_create(&b, NULL, th, &foo);
30
31 pthread_join(a, NULL);
32 pthread_join(b, NULL);
33
34 return 0;
35}