b4ff33a5e0ebbf1ca00c7b4c0a94cf3934eb7d06
[musl] / src / thread / pthread_join.c
1 #include "pthread_impl.h"
2 #include <sys/mman.h>
3
4 int __munmap(void *, size_t);
5
6 int __pthread_join(pthread_t t, void **res)
7 {
8         int tmp;
9         pthread_testcancel();
10         while ((tmp = t->tid)) __timedwait_cp(&t->tid, tmp, 0, 0, 0);
11         if (res) *res = t->result;
12         if (t->map_base) __munmap(t->map_base, t->map_size);
13         return 0;
14 }
15
16 weak_alias(__pthread_join, pthread_join);