static void pthread_handle_free(pthread_descr th)
static void pthread_handle_free(pthread_t th_id)
static void pthread_handle_free(pthread_descr th){  pthread_descr t;  /* Check that the thread th is still there -- pthread_reap_children     might have deallocated it already */  t = __pthread_main_thread;  do {    if (t == th) break;    t = t->p_nextlive;  } while (t != __pthread_main_thread);  if (t != th) {    /* Hum, it might be that the thread already was dequeued but       wasn't detached.  In the case the thread is already detached       and we cannot find it this is a user bug but we must be       gracious.  */    t = non_detached;    while (t != NULL) {      if (t == th) break;      t = t->p_nextlive;    }    if (t == th) {      if (th->p_prevlive == NULL)	non_detached = th->p_nextlive;      else	th->p_prevlive->p_nextlive = th->p_nextlive;      if (th->p_nextlive != NULL)	th->p_nextlive->p_prevlive = th->p_prevlive;      /* Finally free it.  */      pthread_free (th);    }    return;  }  __pthread_lock(th->p_lock);  if (th->p_exited) {    __pthread_unlock(th->p_lock);    pthread_free(th);  } else {    /* The Unix process of the thread is still running.       Mark the thread as detached so that the thread manager will       deallocate its resources when the Unix process exits. */    th->p_detached = 1;    __pthread_unlock(th->p_lock);  }}