#include "pthread_impl.h" #include #include int __munmap(void *, size_t); /* C11 threads cannot be canceled, so there is no need for a cancelation function pointer, here. */ int thrd_join(thrd_t t, int *res) { int tmp; while ((tmp = t->tid)) __timedwait(&t->tid, tmp, 0, 0, 0, 0, 0); if (res) *res = (int)(intptr_t)t->result; if (t->map_base) __munmap(t->map_base, t->map_size); return thrd_success; }