1#include "threads_impl.h" 2#include "zircon_impl.h" 3#include <zircon/process.h> 4#include <threads.h> 5 6int __pthread_detach(pthread_t t) { 7 switch (zxr_thread_detach(&t->zxr_thread)) { 8 case ZX_OK: 9 return 0; 10 case ZX_ERR_BAD_STATE: 11 // It already died before it knew to deallocate itself. 12 _zx_vmar_unmap(_zx_vmar_root_self(), 13 (uintptr_t)t->tcb_region.iov_base, 14 t->tcb_region.iov_len); 15 return 0; 16 default: 17 return ESRCH; 18 } 19} 20 21weak_alias(__pthread_detach, pthread_detach); 22