ARGOBOTS  66b1c39742507d8df30e8d28c54839b961a14814
 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 */
pthread_barrier_t ABTD_xstream_barrier
Definition: abtd.h:31
#define ABT_SUCCESS
Definition: abt.h:64
#define ABT_ERR_XSTREAM_BARRIER
Definition: abt.h:96
#define ABTI_ASSERT(cond)
Definition: abti_error.h:12
#define ABTU_ret_err
Definition: abtu.h:49