3ff Subj : Re: pthread_cond_signal() semantics To : comp.programming.threads From : William Hoggarth Date : Sun Jan 09 2005 10:55 am Thanks for the replies, let's see if I understand correctly: William Hoggarth wrote: > I have a thread with similar to the following: > > while(1) { > get_input(); > > pthread_mutex_lock(&mutex); > copy_input_to_buffer(); > pthread_cond_signal(&cond); > pthread_mutex_unlock(&mutex); > } Ok, let's see if I understand this correctly. 1) pthread_cond_signal(&cond) simply marks the waiting thread as waiting on the mutex ( as if it had just called pthread_mutex_lock() and not pthread_cond_wait() ). 2) pthread_mutex_unlock(&mutex) merely unlocks the mutex, allowing the thread to reaquire the lock before the waiting thread can do so. 3) the most sensible way to get the behaviour I want is to have another condition variable which signals when the data has been processed. Is this right? Thanks, William Hoggarth . 0