Lines Matching +full:0 +full:b
28 * the theoretical pthread_barrier_t range is [0,2147483647].
38 static inline size_t to_posix_barrier_idx(pthread_barrier_t b) in to_posix_barrier_idx() argument
40 return mark_pthread_obj_uninitialized(b); in to_posix_barrier_idx()
43 struct posix_barrier *get_posix_barrier(pthread_barrier_t b) in get_posix_barrier() argument
46 size_t bit = to_posix_barrier_idx(b); in get_posix_barrier()
49 if (!is_pthread_obj_initialized(b)) { in get_posix_barrier()
54 if (sys_bitarray_test_bit(&posix_barrier_bitarray, bit, &actually_initialized) < 0) { in get_posix_barrier()
58 if (actually_initialized == 0) { in get_posix_barrier()
66 int pthread_barrier_wait(pthread_barrier_t *b) in pthread_barrier_wait() argument
70 pthread_barrier_t bb = *b; in pthread_barrier_wait()
79 __ASSERT_NO_MSG(err == 0); in pthread_barrier_wait()
84 bar->count = 0; in pthread_barrier_wait()
90 while (bar->count != 0) { in pthread_barrier_wait()
92 __ASSERT_NO_MSG(err == 0); in pthread_barrier_wait()
96 ret = 0; in pthread_barrier_wait()
100 __ASSERT_NO_MSG(err == 0); in pthread_barrier_wait()
102 __ASSERT_NO_MSG(err == 0); in pthread_barrier_wait()
107 int pthread_barrier_init(pthread_barrier_t *b, const pthread_barrierattr_t *attr, in pthread_barrier_init() argument
113 if (count == 0) { in pthread_barrier_init()
117 if (sys_bitarray_alloc(&posix_barrier_bitarray, 1, &bit) < 0) { in pthread_barrier_init()
123 bar->count = 0; in pthread_barrier_init()
125 *b = mark_pthread_obj_initialized(bit); in pthread_barrier_init()
127 return 0; in pthread_barrier_init()
130 int pthread_barrier_destroy(pthread_barrier_t *b) in pthread_barrier_destroy() argument
136 bar = get_posix_barrier(*b); in pthread_barrier_destroy()
142 if (err < 0) { in pthread_barrier_destroy()
145 __ASSERT_NO_MSG(err == 0); in pthread_barrier_destroy()
148 bar->max = 0; in pthread_barrier_destroy()
149 bar->count = 0; in pthread_barrier_destroy()
153 __ASSERT_NO_MSG(err == 0); in pthread_barrier_destroy()
156 __ASSERT_NO_MSG(err == 0); in pthread_barrier_destroy()
159 __ASSERT_NO_MSG(err == 0); in pthread_barrier_destroy()
161 return 0; in pthread_barrier_destroy()
170 return 0; in pthread_barrierattr_init()
180 return 0; in pthread_barrierattr_setpshared()
188 return 0; in pthread_barrierattr_getpshared()
195 return 0; in pthread_barrierattr_destroy()
203 for (i = 0; i < CONFIG_MAX_PTHREAD_BARRIER_COUNT; ++i) { in pthread_barrier_pool_init()
205 __ASSERT_NO_MSG(err == 0); in pthread_barrier_pool_init()
207 __ASSERT_NO_MSG(err == 0); in pthread_barrier_pool_init()
210 return 0; in pthread_barrier_pool_init()
212 SYS_INIT(pthread_barrier_pool_init, PRE_KERNEL_1, 0);