A Real Condition For A Condition Variable (Cont.) Lets see the real code that will be used with this fictional queue. We'll ignore error handling to simplify the code. We assume that 'q' is a pointer to the Queue's data structure. In the signaling thread: /* lock the mutex. */ pthread_mutex_lock(&mutex); /* add an element to the queue. this increases queue size. */ add_element_to_queue(q, e); /* signal the cond. variable. */ pthread_cond_signal(&cond); /* unlock the mutex. */ pthread_mutex_unlock(&mutex);