8 static volatile bool destr_called;
9 static volatile bool except_caught;
11 static pthread_barrier_t b;
16 // gcc is broken and would generate a warning without this dummy
19 ~monitor() { destr_called = true; }
26 sem_t *s = static_cast<sem_t *> (arg);
32 pthread_barrier_wait (&b);
50 if (pthread_barrier_init (&b, NULL, 2) != 0)
52 puts ("barrier_init failed");
57 if (sem_init (&s, 0, 0) != 0)
59 puts ("sem_init failed");
64 if (pthread_create (&th, NULL, tf, &s) != 0)
66 puts ("pthread_create failed");
70 pthread_barrier_wait (&b);
72 /* There is unfortunately no better method to try to assure the
73 child thread reached the sem_wait call and is actually waiting
74 than to sleep here. */
77 if (pthread_cancel (th) != 0)
79 puts ("cancel failed");
84 if (pthread_join (th, &res) != 0)
90 if (res != PTHREAD_CANCELED)
92 puts ("thread was not canceled");
98 puts ("exception not caught");
104 puts ("destructor not called");
111 #define TEST_FUNCTION do_test ()
113 #include "../test-skeleton.c"