From: Ross Johnson <rpj@ise.canberra.edu.au>
To: pthreads-win32@sources.redhat.com
Subject: Re: Problem with pthread_cond_timedwait().
Date: Wed, 31 Jul 2002 00:13:00 -0000 [thread overview]
Message-ID: <3D478CC4.5030502@ise.canberra.edu.au> (raw)
In-Reply-To: <JEEHINPAHDLKGLNOLIOCKEEJCBAA.nir.nizry@bluesoft-inc.com>
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.
Regards.
Ross
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
> pthread)??
>
> Thanks.
>
> Nir.
>
> I added the code fraction where it get stucked (this is the ONLY place in
> the code where the messageMutex is locked):
>
>
> pthread_mutex_lock(messageMutex);
>
> waitResult = 0;
> while( m_theGeneralQueue->isEmpty() && !shouldStopThreadGlobalLoop &&
> (waitResult != ETIMEDOUT))
> waitResult = pthread_cond_timedwait(newMessageEvent, messageMutex,
> &timeout);
>
> pthread_mutex_unlock(messageMutex);
>
>
> -----------------------------------------
>
> mailto:nir.nizry@bluesoft-inc.com
>
> -----------------------------------------
next prev parent reply other threads:[~2002-07-31 7:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-22 21:19 Nir Nizry
2002-07-24 0:31 ` Ross Johnson
2002-07-31 0:13 ` Ross Johnson [this message]
2005-09-27 11:13 Fu Limin
2005-09-27 13:16 ` Dmitrii Sernii
[not found] ` <1130.130.192.136.198.1127830895.squirrel@130.192.136.198>
2005-09-27 15:49 ` Dmitrii Sernii
2005-09-28 8:38 ` Fu Limin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3D478CC4.5030502@ise.canberra.edu.au \
--to=rpj@ise.canberra.edu.au \
--cc=pthreads-win32@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).