Home | History | Annotate | Download | only in tests
      1 /* A simple race - test symaddr */
      2 
      3 #include <pthread.h>
      4 #include <unistd.h>
      5 
      6 struct foo {
      7 	struct bar {
      8 		int plop[22];
      9 		char biff;
     10 	} poot[11];
     11 };
     12 
     13 static 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 
     22 int 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 }
     36