pthread_descr t;   t = __pthread_main_thread; do { if (t == th) break; t = t->p_nextlive; } while (t != __pthread_main_thread); if (t != th) return;
static void pthread_free(pthread_descr th){  pthread_handle handle;  ASSERT(th->p_exited);  /* Make the handle invalid */  handle =  thread_handle(th->p_tid);  acquire(&handle->h_spinlock);  handle->h_descr = NULL;  release(&handle->h_spinlock);  /* If initial thread, nothing to free */  if (th == &__pthread_initial_thread) return;  if (!th->p_userstack)    {      /* Free the stack and thread descriptor area */      munmap((caddr_t) ((char *)(th+1) - STACK_SIZE), STACK_SIZE);      if (th->p_guardsize != 0)	munmap(th->p_guardaddr, th->p_guardsize);    }}