Re: [PATCH v3] Threaded grep
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Jan 18, 2010, 13:45 UTC
- Message-ID
- <4B546608.4010503@viscovery.net>
- In-Reply-To
- <4c8ef71001180528h6182ef4l8a617fd038bd7318@mail.gmail.com>
Fredrik Kuivinen schrieb:
Show 8 quoted lines
> On Mon, Jan 18, 2010 at 12:11, Johannes Sixt <j.sixt@viscovery.net> 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