brnstnd@stealth.acf.nyu.edu (01/17/90)
For amusement I'm writing a BSD library for dealing with signals in The Right Way. Each signal gets a stack of handlers, invoked one at a time when the signal arrives. There are functions for manipulating the stacks, temporarily blocking a signal (but receiving it when the block is released), turning off the special handling, etc. What else do people want? Should there be special routines dealing with particular signals: CHLD, time signals (ALRM, VTALRM, PROF), and so on? On the same subject: How does one correctly code ANSI C raise() so as to prevent race conditions? I want to make sure I'm not messing this up. ---Dan
gwyn@smoke.BRL.MIL (Doug Gwyn) (01/17/90)
In article <20926@stealth.acf.nyu.edu> brnstnd@stealth.acf.nyu.edu (Dan Bernstein) writes: >On the same subject: How does one correctly code ANSI C raise() so as to >prevent race conditions? I want to make sure I'm not messing this up. /* raise() -- send a signal to the current process public-domain implementation last edit: 16-Jan-1990 Gwyn@BRL.MIL complies with the following standards: ANSI X3.159-1989 IEEE Std 1003.1-1988 SVID Issue 3 */ extern int getpid(), kill(); /* UNIX/POSIX system calls */ int raise(sig) int sig; { return kill(getpid(), sig); /* set errno to EINVAL if sig invalid */ }