musl/src/thread/pthread_join.c
Jens Gustedt df7d0dfb9c use weak symbols for the POSIX functions that will be used by C threads
The intent of this is to avoid name space pollution of the C threads
implementation.

This has two sides to it. First we have to provide symbols that wouldn't
pollute the name space for the C threads implementation. Second we have
to clean up some internal uses of POSIX functions such that they don't
implicitly drag in such symbols.
2014-09-06 18:11:24 -04:00

20 lines
399 B
C

#include "pthread_impl.h"
#include <sys/mman.h>
int __munmap(void *, size_t);
static void dummy(void *p)
{
}
int __pthread_join(pthread_t t, void **res)
{
int tmp;
pthread_testcancel();
while ((tmp = t->tid)) __timedwait(&t->tid, tmp, 0, 0, dummy, 0, 0);
if (res) *res = t->result;
if (t->map_base) __munmap(t->map_base, t->map_size);
return 0;
}
weak_alias(__pthread_join, pthread_join);