Subject: Re: signal handler context...
To: gabriel rosenkoetter <gr@eclipsed.net>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 01/24/2002 12:02:26
On Thu, 24 Jan 2002, gabriel rosenkoetter wrote:

> On Mon, Dec 17, 2001 at 06:06:29PM -0800, Bill Studenmund wrote:
> > Then you provide a way for the program to tell you. ;-) Say a flag passed
> > in.
>
> I'm not sure that really fixes what Stephane describes as the
> problem.
>
> This requires that the user know that the function behaves differently
> when called from a signal handler and when not, at which point he
> might as well just know not to call the function from a signal
> handler, which is what Stephane was trying to make him not think
> about.
>
> Am I missing something?

I disagree with the part after, "might as well." Knowing the routine needs
to know if it was called in a signal handler does not mean that you
shouldn't call it from a signal handler, just that you need to tell it if
you are in a signal handler.

If you're writing a signal handler, you should know that there are fewer
things you can do in it, so telling library functions that they are in a
signal handler shouldn't be a surprise. :-)

Take care,

Bill