Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

21. Signals: Signal Handlers > Interruption and Restarting of System Calls

Interruption and Restarting of System Calls

Consider the following scenario:

  1. We establish a handler for some signal.

  2. We make a blocking system call, for example, a read() from a terminal device, which blocks until input is supplied.

  3. While the system call is blocked, the signal for which we established a handler is delivered, and its signal handler is invoked.

What happens after the signal handler returns? By default, the system call fails with the error EINTR (“Interrupted function”). This can be a useful feature. In Setting Timeouts on Blocking Operations, we’ll see how to use a timer (which results in the delivery of a SIGALRM signal) to set a timeout on a blocking system call such as read().


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint