From: Dmitry Potapov Date: Thu, 05 Nov 2009 13:48:58 GMT Subject: Re: [PATCH] MSVC: port pthread code to native Windows threads Message-ID: <20091105134858.GG27126@dpotapov.dyndns.org> In-Reply-To: <16cee31f0911040547m69e5b9cbi30e20d2a7790bd6f@mail.gmail.com> On Wed, Nov 04, 2009 at 02:47:09PM +0100, Andrzej K. Haczewski wrote: > 2009/11/4 Johannes Sixt : > > > - pthread_cond_signal is called while the mutex is held. > > AFAIK that is a requirement for condition variable to be signaled > while holding the same mutex that other threads cond_wait on. I just > don't check that it is true, because Git is locking mutex. There is no such requirement in POSIX: The pthread_cond_broadcast() or pthread_cond_signal() functions may be called by a thread whether or not it currently owns the mutex that threads calling pthread_cond_wait() or pthread_cond_timedwait() have associated with the condition variable during their waits; however, if predictable scheduling behavior is required, then that mutex shall be locked by the thread calling pthread_cond_broadcast() or pthread_cond_signal(). http://www.opengroup.org/onlinepubs/009695399/functions/pthread_cond_signal.html Dmitry