#include "pthread.h" #include #include #include #include extern void pthread_exit(void *retval) { struct __pthread *self = pthread_self(); if (!self) { /* TODO: abort(); */ return; } if (self->thr_flags & THREAD_DETACHED) { kern_handle_t task; kern_handle_t address_space; task_self(&task); task_get_address_space(task, &address_space); kern_handle_close(task); __pthread_unmap_exit( address_space, self->thr_map_base, self->thr_map_size); } else { self->thr_result = retval; thread_exit(); } }