Subject: Re: save/restore fpu for the signal handler call
To: None <port-i386@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-i386
Date: 11/30/2005 16:29:13
>> So it should be perfectly legal to call printf() from a signal
>> handler which is carefully blocked around calls to unsafe functions,
>> because this does not fall in the exception above, no?
> It is not legal. Each invocation of the "unsafe" function needs to
> be protected from being interrupted by a signal for this to work.
Right. "...which is carefully blocked around calls to unsafe
functions".
> Unfortunately you cannot predict which "unsafe" function might call
> another "unsafe" function, so you'll have to protect all of them.
Right. "...which is carefully blocked around calls to unsafe
functions". Not "...around calls to that function".
As I read it, Pavel was right: it's perfectly legal to call printf()
from a signal handler provided you make sure that the signal in
question can never be delivered during a call to an unsafe function
(printf or other).
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse@rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B