Lines Matching full:bar
33 static inline size_t posix_barrier_to_offset(struct posix_barrier *bar) in posix_barrier_to_offset() argument
35 return bar - posix_barrier_pool; in posix_barrier_to_offset()
71 struct posix_barrier *bar; in pthread_barrier_wait() local
73 bar = get_posix_barrier(bb); in pthread_barrier_wait()
74 if (bar == NULL) { in pthread_barrier_wait()
78 err = k_mutex_lock(&bar->mutex, K_FOREVER); in pthread_barrier_wait()
81 ++bar->count; in pthread_barrier_wait()
83 if (bar->count == bar->max) { in pthread_barrier_wait()
84 bar->count = 0; in pthread_barrier_wait()
90 while (bar->count != 0) { in pthread_barrier_wait()
91 err = k_condvar_wait(&bar->cond, &bar->mutex, K_FOREVER); in pthread_barrier_wait()
99 err = k_condvar_signal(&bar->cond); in pthread_barrier_wait()
101 err = k_mutex_unlock(&bar->mutex); in pthread_barrier_wait()
111 struct posix_barrier *bar; in pthread_barrier_init() local
121 bar = &posix_barrier_pool[bit]; in pthread_barrier_init()
122 bar->max = count; in pthread_barrier_init()
123 bar->count = 0; in pthread_barrier_init()
134 struct posix_barrier *bar; in pthread_barrier_destroy() local
136 bar = get_posix_barrier(*b); in pthread_barrier_destroy()
137 if (bar == NULL) { in pthread_barrier_destroy()
141 err = k_mutex_lock(&bar->mutex, K_FOREVER); in pthread_barrier_destroy()
148 bar->max = 0; in pthread_barrier_destroy()
149 bar->count = 0; in pthread_barrier_destroy()
151 bit = posix_barrier_to_offset(bar); in pthread_barrier_destroy()
155 err = k_condvar_broadcast(&bar->cond); in pthread_barrier_destroy()
158 err = k_mutex_unlock(&bar->mutex); in pthread_barrier_destroy()