From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30289 invoked by alias); 31 Jul 2002 07:13:01 -0000 Mailing-List: contact pthreads-win32-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sources.redhat.com Received: (qmail 30276 invoked from network); 31 Jul 2002 07:13:00 -0000 Received: from unknown (HELO digit.ise.canberra.edu.au) (137.92.140.41) by sources.redhat.com with SMTP; 31 Jul 2002 07:13:00 -0000 Received: from ise.canberra.edu.au (localhost.localdomain [127.0.0.1]) by digit.ise.canberra.edu.au (8.11.6/8.11.6) with ESMTP id g6V77nF11083; Wed, 31 Jul 2002 17:07:49 +1000 Message-ID: <3D478CC4.5030502@ise.canberra.edu.au> Date: Wed, 31 Jul 2002 00:13:00 -0000 From: Ross Johnson Organization: University of Canberra, Information Sciences and Engineering User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020513 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pthreads-win32@sources.redhat.com Subject: Re: Problem with pthread_cond_timedwait(). References: Content-Type: text/plain; charset=windows-1255; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002/txt/msg00087.txt.bz2 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 > > -----------------------------------------