From: Johannes Sixt Date: Mon, 18 Jan 2010 13:45:44 GMT Subject: Re: [PATCH v3] Threaded grep Message-ID: <4B546608.4010503@viscovery.net> In-Reply-To: <4c8ef71001180528h6182ef4l8a617fd038bd7318@mail.gmail.com> Fredrik Kuivinen schrieb: > On Mon, Jan 18, 2010 at 12:11, Johannes Sixt wrote: >> Fredrik Kuivinen schrieb: >>> + pthread_mutex_unlock(&grep_lock); >>> + pthread_cond_signal(&cond_add); >> Please swap these two lines, so that pthread_cond_signal() is called while >> the lock is held. > > May I ask why? (just curious) Because our pthreads_cond_* functions on Windows are not POSIXly correct and work reliably only when pthread_cond_signal() is called while the mutex is held. -- Hannes