pspp-dev
[Top][All Lists]
Advanced

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

Re: netbsd build update


From: John Darrington
Subject: Re: netbsd build update
Date: Sat, 20 May 2006 08:21:18 +0800
User-agent: Mutt/1.5.4i

On Fri, May 19, 2006 at 07:17:48AM -0700, Ben Pfaff wrote:
     John Darrington <address@hidden> writes:
     
     >      Furthermore, I doubt it's possible portably.  I suspect that some
     >      CPUs will in fact retry the instruction and fault again in a loop.
     >
     > They all will.  A signal handler returns to the address that caused it.
     > Provided that sigaction (part of the POSIX standard) is supported we
     > can reliably overcome this problem thus:
     >
     > We have two signal handlers:  fpe_handler_ignore, which does nothing,
     > and fpe_handler_warn which a) logs a warning message, b) resets the
     > handler to fpe_handler_ignore, and c) returns.
     >
     > At the start of every procedure, the active handler is reset to 
     > fpe_handler_warn.   Thus, when a FPE occurs, the user gets a warning,
     > the handler is set to ignore further FPEs and the procedure completes
     > normally.  The user gets his results, but has been warned that they
     > might not be correct.
     
     You know, I take back my earlier comments.  This is pretty
     reasonable, but only as long as the signal handler only sets a
     flag that indicates an error has occurred, and masks further
     exceptions.  Then leave the real handling up to the caller.  If
     the caller notices, it can comment on it (and reset it);
     otherwise, the main loop can issue a warning after the procedure
     completes.
     
     (Doing I/O in a signal handler is really a bad idea.)

True.  Signal handlers need to be fast.
     
     We still need to be able to mask exceptions, though.  Otherwise,
     fpe_handler_ignore will just get called in an infinite loop,
     which is not an improvement.  Thus, I believe that we really want
     "fpe_handler_record".

Yes.  Posix provides sigprocmask to do this.

J'

-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.


Attachment: pgpBsb3pPcAsY.pgp
Description: PGP signature


reply via email to

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