monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: monit restart bug/race condition (3.1 and current CVS version behav


From: Jan-Henrik Haukeland
Subject: Re: monit restart bug/race condition (3.1 and current CVS version behavior)
Date: 10 Feb 2003 22:47:57 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Civil Service)

Martin Pala <address@hidden> writes:

> Jan-Henrik Haukeland wrote:
> 
> >And the validate.c:do_not_validate() and util.is_process_running()
> >methods should (probably) use the same mutex,
> >
> I think it will be better to not use that mutex here because it is
> highly dependant on context. In addition if we put mutex to
> do_not_validate() i think it will end up in deadlock:
> 
> 
> do_validate()
> lock mutex
> do_not_validate() -> would block on above locked mutex => deadlock

Sure, in this case it would be a deadlock but I wasn't thinking about
locking all the code in validate() with the mutex. Normally, I like to
use a mutex around as few lines of code as possible to avoid
serializing to much, since only one thread at the time can run a
serialized block. This is rather important if your write high
performance multi-threaded servers, for instance a web-server. But in
monit's case it's totally okay to serialized large chunks of code like
you have done. I'll buy it :-)

-- 
Jan-Henrik Haukeland




reply via email to

[Prev in Thread] Current Thread [Next in Thread]