ARGOBOTS  c6511494322293e01714f56f341b8d2b22c1e3c1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
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 ABTU_ret_err static inline int
11 ABTD_xstream_barrier_init(uint32_t num_waiters, 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 void ABTD_xstream_barrier_destroy(ABTD_xstream_barrier *p_barrier)
18 {
19  int ret = pthread_barrier_destroy(p_barrier);
20  ABTI_ASSERT(ret == 0);
21 }
22 
23 static inline void ABTD_xstream_barrier_wait(ABTD_xstream_barrier *p_barrier)
24 {
25  int ret = pthread_barrier_wait(p_barrier);
26  ABTI_ASSERT(ret == PTHREAD_BARRIER_SERIAL_THREAD || ret == 0);
27 }
28 #endif
29 
30 #endif /* ABTD_STREAM_H_INCLUDED */
#define ABT_SUCCESS
Definition: abt.h:64
#define ABT_ERR_XSTREAM_BARRIER
Definition: abt.h:96
#define ABTU_ret_err
Definition: abtu.h:49