| Example | Relevant Functions |
10.1 | Catch SIGUSR1 and SIGUSR2 |
signal,
pause
|
10.2 | Call a non-reentrant function from a signal handler (Bad) |
signal,
alarm,
getpwnam
|
10.3 | SYSV SIGCLD example that doesn't work (non reliable signals) |
fork,
signal,
wait,
sleep,
pause,
exit
|
10.4 | sleep1: Simple incomplete implementation of sleep |
signal,
alarm,
pause
|
10.5 | sleep2: Another imperfect implementation of sleep |
signal,
alarm,
pause,
setjmp,
longjmp
|
10.6 | Calling sleep2
(10.5 above) from a program that catches other signals |
[Just to demonstrate the problem]
|
10.7 | Calling blocking read with a timeout |
signal,
alarm,
read,
write
|
10.8 | Better: Calling blocking read with a timeout using longjmp |
signal,
alarm,
read,
write,
setjmp,
longjmp
|
10.9 | Implementation of sigaddset, sigdelset, and sigismember |
signal.h
|
10.10 | Pring the signal mask for current process |
sigprocmask,
sigismember
|
10.11 | Temporarily blocking signals |
signal,
sigprocmask,
sigemptyset,
sigaddset,
sigismember,
sigpending,
sleep
|
10.12 | An implementation of a reliable (BSD style) signal using POSIX sigaction |
sigemptyset,
sigaction
|
10.13 | signal_intr: signal that prevents interrupted syscalls from being restarted |
sigemptyset,
sigaction
|
10.14 | Signal masks and non local gotos |
signal,
sigsetjmp,
siglongjmp,
alarm
|
10.15 | Protecting a critical region from a signal |
signal,
sigemptyset,
sigaddset,
sigprocmask,
sigsuspend
|
10.16 | Using sigsuspend to wait for a global variable to be set |
signal,
sigemptyset,
sigaddset,
sigprocmask,
sigsuspend
|
10.17 |
Routines to allow parent and child processes to synchronize
(Using signals):
TELL_WAIT: Init function
TELL_PARENT: Child: notify parent
TELL_CHILD: Parent: notify child
WAIT_PARENT: Child: wait for parent notification
WAIT_CHILD: Parent: wait for child notification
|
The implementation:
Synchronization library (SunOs),
Synchronization library (4.4BSD),
Synchronization library (SVR4)
|
10.18 | POSIX.1 implementation of
abort |
sigaction,
sigfillset,
sigdelset,
sigprocmask,
kill,
fflush
|
10.19 | Bad system usage example:
Using the system implementation
from 8.12
Causes signal-catching interactions between parent and child |
signal,
system
|
10.20 | Good example: a correct system implementation
with appropriate signal handling |
sigemptyset,
sigaddset,
sigaction,
sigprocmask,
fork,
execl,
_exit,
waitpid
|
10.21 | POSIX.1 style reliable implementation of sleep (unlike 4.3BSD) |
sigemptyset,
sigaddset,
sigaction,
sigprocmask,
alarm,
sigdelset,
sigsuspend
|
10.22 | Job control: handling SIGTSTP correctly |
sigemptyset,
sigaddset,
sigprocmask,
signal,
kill
|