This is the mail archive of the mailing list for the pthreas-win32 project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem with pthread_cond_timedwait().

Hi all,

This is to let people know that Alexander Terekhov has located the problem, with a suspicion of possibly a deeper problem elsewhere (which will be investigated), and provided a fix which is now in the CVS repository.

The latest CVS tree has passed both the test suite and the test program used to illustrate the bug.

A new snapshot will be produced soon.


Nir Nizry wrote:
Hello All,

I have a problem with pthread_cond_timedwait().
I have a system with 5 threads that in their main loop wait with a timeout
(timedwait) on a condition variable to be set.
what I get is, that sometimes a thread enters the pthread_cond_timedwait()
function, and doesn't come out, even if the timeout time arrives. after this
happens, the other threads get stuck in the mutex lock before entering the
pthread_cond_timedwait() as if the mutex is already locked.

I suspect that somehow either the pthread_cond_timedwait() function does not
release the mutex or does not return when the timeout occurs.

does someone have an idea' or know of such an incident (or maybe a bug in



I added the code fraction where it get stucked (this is the ONLY place in
the code where the messageMutex is locked):


waitResult = 0;
while( m_theGeneralQueue->isEmpty() && !shouldStopThreadGlobalLoop &&
(waitResult != ETIMEDOUT))
	waitResult = pthread_cond_timedwait(newMessageEvent, messageMutex,




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]