From mboxrd@z Thu Jan 1 00:00:00 1970 From: Taci Ülker To: Pthreads Developers List Subject: Question about condition variable Date: Wed, 14 Jun 2000 18:06:00 -0000 Message-id: <39482BD2.7A4DE7D5@uni-paderborn.de> References: <14453.4956.759854.712859@cabletron.com> <14463.19695.396800.542343@cabletron.com> X-SW-Source: 2000/msg00025.html Hello all, I am developing a software based on win32-pthreads (latest available). My problem I encountered is: I have an object for message queuing, wich is intended to let the callers thread wait by getMessage(LPSSMSG lpMsg), until a new message is posted by any other thread. Now imagine, the thread which is waiting for new messages is in status ACTIVE (sleeping or not running) in operating system. The thread wich is posting a new message is in status RUNNING. This running thread pushes at first a new message into the queue and signals the waiting thread to be waked up and unlocks the mutex immediately, so that other threads can push further new messages. Now, the problem is when the signal is given to wake up the waiting thread by the first message pushing thread then the OS dont switch automatically its thread execution. This means if the thread is not waked up, because it is not switched to stutus RUNNING and an other thread pushes further new message in to the queue and signals also the waiting thread then what is about the first and second signals? I am actually switching thread execution with sleep(0) function, after each message posting.