ARGOBOTS
abtd_stream.h
Go to the documentation of this file.
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3  * See COPYRIGHT in top-level directory.
4  */
5 
6 #ifndef ABTD_STREAM_H_INCLUDED
7 #define ABTD_STREAM_H_INCLUDED
8 
9 #ifdef HAVE_PTHREAD_BARRIER_INIT
10 static inline int ABTD_xstream_barrier_init(uint32_t num_waiters,
11  ABTD_xstream_barrier *p_barrier)
12 {
13  int ret = pthread_barrier_init(p_barrier, NULL, num_waiters);
14  return (ret == 0) ? ABT_SUCCESS : ABT_ERR_XSTREAM_BARRIER;
15 }
16 
17 static inline int ABTD_xstream_barrier_destroy(ABTD_xstream_barrier *p_barrier)
18 {
19  int ret = pthread_barrier_destroy(p_barrier);
20  return (ret == 0) ? ABT_SUCCESS : ABT_ERR_XSTREAM_BARRIER;
21 }
22 
23 static inline int ABTD_xstream_barrier_wait(ABTD_xstream_barrier *p_barrier)
24 {
25  return pthread_barrier_wait(p_barrier);
26 }
27 #endif
28 
29 #endif /* ABTD_STREAM_H_INCLUDED */
#define ABT_SUCCESS
Definition: abt.h:64
#define ABT_ERR_XSTREAM_BARRIER
Definition: abt.h:95