Home | History | Annotate | Download | only in tests
      1 /* Test program to verify whether DRD only complains about uninitialized
      2  * condition variables for dynamically allocated memory.
      3  */
      4 
      5 
      6 #include <pthread.h>
      7 #include <stdio.h>
      8 
      9 
     10 static pthread_cond_t s_cond1 = PTHREAD_COND_INITIALIZER;
     11 static pthread_cond_t s_cond2 = PTHREAD_COND_INITIALIZER;
     12 
     13 
     14 int main(int argc, char** argv)
     15 {
     16     fprintf(stderr, "Statically initialized condition variable.\n");
     17 
     18     pthread_cond_signal(&s_cond1);
     19 
     20     fprintf(stderr, "Uninitialized condition variable.\n");
     21 
     22     *((char*)&s_cond2 + sizeof(s_cond2) - 1) ^= 1;
     23     pthread_cond_signal(&s_cond2);
     24 
     25     fprintf(stderr, "Done.\n");
     26 
     27     return 0;
     28 }
     29