Subject: Re: merge of freebsd eventhandler
To: YAMAMOTO Takashi <email@example.com>
From: Brett Lymn <firstname.lastname@example.org>
Date: 05/27/2006 23:48:34
On Sat, May 27, 2006 at 04:36:05PM +0900, YAMAMOTO Takashi wrote:
> and they make _EVENTHANDLER_INVOKE even bigger...
Not by a whole lot, the mask function adds a couple more terms to an
if conditional, run once adds a simple if statement. Not large
> do you mean that doshutdownhooks can be called again and again?
> i don't think it happens in normal path.
I agree, I don't think it happens in the normal path but _someone_
felt the need to carefully remove the list entries when the shutdown
hooks were run and add a comment saying this was done to ensure the
hooks were only run once in the orignal code I replaced. I do not
feel qualified to overrule that decision.
> in the case of mountroothook, i doubt it should have been
> implemented as a hook in the first place.
Again, I don't know why it was there but someone put a gating around
whether or not the hook function would be run. I chose to build in
functionality to perform the same.
> i personally don't think it's so bad to use an xxx_args structure argument.
ok, I was going down this line of thinking too when I first proposed
the generic hooking interface. If we do this there are two
1) we do the same sort of macro tricks so the hook functions get
passed the correctly typed xxx_args pointer.
2) we just cast to and from void * and hope that the arg structure we
are getting is what we expected.
1 is, I think, about as complex as what eventhandler currently uses
but should error during compile. 2 is fast and loose and will cause
some "interesting" effects at run time if the function is not passed
the correct structure.
> a big downside is _EVENTHANDLER_INVOKE itself,
> which is a big and complex macro.
It is, there is no arguing with that. We do have other macros which
are of about the same complexity - see queue.h for examples.
As it stands, the eventhandler interface I have proposed is
compatable with the FreeBSD version. It may be a small thing but it
would be nice if we can have a common interface.