static inline void enqueue(pthread_queue * q, pthread_descr th)
static inline void enqueue(pthread_descr * q, pthread_descr th)
static inline void enqueue(pthread_queue * q, pthread_descr th){  int prio;  pthread_descr * elt;  ASSERT(th->p_nextwaiting == NULL);  if (q->tail == NULL) {    q->head = th;    q->tail = th;    return;  }  prio = th->p_priority;  if (prio > 0) {    /* Insert in queue according to priority order */    for (elt = &(q->head); *elt != NULL; elt = &((*elt)->p_nextwaiting)) {      if (prio > (*elt)->p_priority) {        th->p_nextwaiting = *elt;        *elt = th;        return;      }    }  }  /* Priority is no greater than any thread in the queue.     Insert at end of queue */  q->tail->p_nextwaiting = th;  q->tail = th;}