Yahoo Groups archive

Milter-greylist

Index last updated: 2026-04-28 23:32 UTC

Message

Re: [milter-greylist] libpthread: Invalid condition variable

2009-09-16 by Petar Bogdanovic

On Wed, Sep 16, 2009 at 04:36:10AM +0200, manu@... wrote:
> Petar Bogdanovic <petar@...> wrote:
> 
> >    Until -r1.217 of milter-greylist.c, dump_sleepflag was initialized
> >    through pthread_cond_init(), called by dump_init().  That's why I
> >    didn't notice earlier.  dump_init() is in store.c now.
> 
> But with your patch you now initiliaze ir twice. Could'nt that cause
> problems?

From what I've seen, no.  But OTOH I don't know much about libpthread.

But even if you want to do it right (through mg_init() which contains
dump_init() and is in store.c):  The problem is that you have a
chicken/egg situation here since conf_load() needs mg_init() (because of
dump_init()) and mg_init() needs conf_load() (because of the conf
struct).

I would suggest dropping pthread_cond_init() which is the only thing
dump_init() actually does.  man pthread_cond_init() says:

	``In cases where default condition variable attributes are
	  appropriate, the macro PTHREAD_COND_INITIALIZER can be used to
	  initialise condition variables that are statically allocated.
	  The effect is equivalent to dynamic initialisation by a call
	  to pthread_cond_init() with parameter attr specified as NULL,
	  except that no error checks are performed.''

Since dump.c already uses PTHREAD_MUTEX_INITIALIZER instead of
pthread_mutex_init(), this would be consistent.



   Petar Bogdanovic



P.S.
	Why am I the only person with this problem?

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.