diff options
Diffstat (limited to 'tests/barrier2.c')
-rw-r--r-- | tests/barrier2.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/barrier2.c b/tests/barrier2.c new file mode 100644 index 0000000..c7b174c --- /dev/null +++ b/tests/barrier2.c @@ -0,0 +1,23 @@ +/* + * barrier2.c + * + * Declare a single barrier object, wait on it, + * and then destroy it. + * + */ + +#include "test.h" + +pthread_barrier_t barrier = NULL; + +int +main() +{ + assert(pthread_barrier_init(&barrier, NULL, 1) == 0); + + assert(pthread_barrier_wait(&barrier) == PTHREAD_BARRIER_SERIAL_THREAD); + + assert(pthread_barrier_destroy(&barrier) == 0); + + return 0; +} |