Home | History | Annotate | Download | only in tests
      1 /* All OK - test allowed read sharing */
      2 
      3 #include <pthread.h>
      4 #include <assert.h>
      5 
      6 static int shared;
      7 
      8 static void *t1(void *v)
      9 {
     10 	return (void *)(long)(shared + 44);
     11 }
     12 
     13 static void *t2(void *v)
     14 {
     15 	return (void *)(long)(shared + 55);
     16 }
     17 
     18 int main()
     19 {
     20 	pthread_t a, b;
     21 
     22 	shared = 22;
     23 
     24 	pthread_create(&a, NULL, t1, NULL);
     25 	pthread_create(&b, NULL, t2, NULL);
     26 
     27 	pthread_join(a, NULL);
     28 	pthread_join(b, NULL);
     29 
     30 	assert(shared == 22);
     31 
     32 	return 0;
     33 }
     34