pthread_cond_wait(&old_cpptr->c, &ct_mutex); pthread_mutex_unlock(&ct_mutex);
LWP_INT_WAIT(&old_cpptr->c, &ct_mutex); LWP_INT_UNLOCK(&ct_mutex); Debug(0, ("LWP_QWait:%s woke up \n", old_cpptr->name));
LWP_QWait(){    PROCESS old_cpptr;    Debug(0, ("LWP_QWait: %s is going to QWait\n", lwp_cpptr->name));    lwp_cpptr->status = QWAITING;    if (runnable[lwp_cpptr->priority].count == 0)	Cal_Highest_runnable_priority();    old_cpptr = lwp_cpptr;    /* wake up next lwp */    lwp_cpptr = runnable[Highest_runnable_priority].head;    lwpremove(lwp_cpptr, &runnable[Highest_runnable_priority]);    timerclear(&lwp_cpptr->lastReady);    pthread_mutex_lock(&ct_mutex);    Debug(0, ("LWP_QWait:%s going to wake up %s \n", old_cpptr->name, 	      lwp_cpptr->name));    pthread_cond_signal(&lwp_cpptr->c);    /* sleep on your own condition */    Debug(0, ("LWP_QWait:%s going to wait on own condition \n", 	      old_cpptr->name));    pthread_cond_wait(&old_cpptr->c, &ct_mutex);    pthread_mutex_unlock(&ct_mutex);    lwp_cpptr = old_cpptr;    /* return only if calling process' priority is the highest */    if (lwp_cpptr->priority < Highest_runnable_priority)	    Dispatcher();    return LWP_SUCCESS;}