ARGOBOTS  1.1
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 */
ABTI_ASSERT
#define ABTI_ASSERT(cond)
Definition: abti_error.h:12
ABT_SUCCESS
#define ABT_SUCCESS
Error code: the routine returns successfully.
Definition: abt.h:92
ABTU_ret_err
#define ABTU_ret_err
Definition: abtu.h:146
ABT_ERR_XSTREAM_BARRIER
#define ABT_ERR_XSTREAM_BARRIER
Error code: error related to an execution stream.
Definition: abt.h:267
ABTD_xstream_barrier
void * ABTD_xstream_barrier
Definition: abtd.h:36