[Openais] Re: just looked at some of the openais code,
have some comments
Chris Friesen
cfriesen at nortelnetworks.com
Tue Jun 29 10:24:33 PDT 2004
Steven Dake wrote:
> I am likely to make a
> portability library of things like threads/condition variables/reference
> counting for the library. That library could conditionally noop the
> code for threads if necessary.
Sounds good.
> I feel a little uncomfortable, as a library, changing signal handlers.
> The SA Forum AIS WG is in process of specifying what exactly happens in
> a signal handler (should APIs be allowed or not). I'll take this input
> to the specs group.
Yeah. It's always a bit of a dilemma as to how to deal with signals. You could
just put a stake in the ground and say that no library functions are async-safe,
so if the user wants to use them in signal handlers they would just have to
block signals around all library calls.
> You mean add a flag to saClmDispatch? The downside of that approach is
> that the API then becomes nonstandard for a small performance payoff.
Yes, that's what I had in mind. However, I had forgotten that there were
standards that you were coding to.
> I'd like to match the AIS standard as much as possible, even when it
> means performance won't be right. The longer-term approach to this
> problem is to drive that kind of feedback into the specs group which
> I'll do.
Cool. That'd be great.
> I see the light now... Refcounting is the way to go, especially for
> handling dispatch and finalize calls. Then the mutex wont have to be
> held across callbacks and a bunch of other problems go away too.
I'm glad you like the refcount idea. I don't know how familiar you are with the
kernel code, but they use refcounts all over the place.
I've been looking at the code a bit more and have a few other comments:
1) In the test programs, you've got select() being called in while loops. When
select() returns, the fd sets will be modified to reflect what fds had events
occur. If you get a signal, you can exit select() with empty fd sets, and you
will no longer monitor anything. You need to either copy the fd set to a
working one each loop, or else recreate the fd set each time through the loop.
2) There's a small niggle in testamf.c, HealthcheckCallback(). The print
statement will run every time since the loop is commented out, but it prints
that 20 checks have occurred.
3) It might be nice to be able to set the cluster name and node name.
4) The magical version of
SaVersionT version = { 'A', 1, 1 };
is a bit confusing. I wonder if it could be made a constant or something rather
than having to be explicitly typed out by the user?
Chris
More information about the Openais
mailing list