summaryrefslogtreecommitdiff
path: root/tests/barrier2.c
blob: c7b174cd26cac13691500bfcaa4ffa84873bc459 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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;
}