1#include "threads_impl.h"
2#include <zircon/process.h>
3
4int __pthread_join(pthread_t t, void** res) {
5    switch (zxr_thread_join(&t->zxr_thread)) {
6    case ZX_OK:
7        if (res)
8            *res = t->result;
9        _zx_vmar_unmap(_zx_vmar_root_self(),
10                       (uintptr_t)t->tcb_region.iov_base,
11                       t->tcb_region.iov_len);
12        return 0;
13    default:
14        return EINVAL;
15    }
16}
17
18weak_alias(__pthread_join, pthread_join);
19