Within that time the processor can execute millions

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: t signum, handler_t *handler) { struct sigaction action, old_action; action.sa_handler = handler; sigemptyset(&action.sa_mask); /* block sigs of type being handled */ action.sa_flags = SA_RESTART; /* restart syscalls if possible */ if (sigaction(signum, &action, &old_action) < 0) unix_error("Signal error"); return (old_action.sa_handler); } code/src/csapp.c Figure 8.31: Signal: A wrapper for sigaction that provides portable signal handling on Posixcompliant systems. ¯ ¯ Interrupted system calls are automatically restarted whenever possible. Once the signal handler is installed, it remains installed until Signal is called with a handler argument of either SIG IGN or SIG DFL. (Some older Unix systems restore the signal action to its default action after a signal has been processed by a handler.) Figure 8.32 shows a version of the signal2 program from Figure 8.29 that uses our Signal wrapper to get predictable signal handling semantics on different computer systems. The only diffe...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online