barrier destroy must also wait for threads in other processes exiting barrier
[musl] / src / thread / pthread_barrier_destroy.c
1 #include "pthread_impl.h"
2
3 void __vm_lock(int), __vm_unlock(void);
4
5 int pthread_barrier_destroy(pthread_barrier_t *b)
6 {
7         if (b->_b_limit < 0) {
8                 int seq = b->_b_seq;
9                 if (seq & 1) __wait(&b->_b_seq, 0, seq, 0);
10                 __vm_lock(-1);
11                 __vm_unlock();
12         }
13         return 0;
14 }