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 > Other Methods of Terminating a Signal Handler

Other Methods of Terminating a Signal Handler

All of the signal handlers that we have looked at so far complete by returning to the main program. However, simply returning from a signal handler sometimes isn’t desirable, or in some cases, isn’t even useful. (We’ll see an example of where returning from a signal handler isn’t useful when we discuss hardware-generated signals in Section 22.4.)

There are various other ways of terminating a signal handler:

  • Use _exit() to terminate the process. Beforehand, the handler may carry out some cleanup actions. Note that we can’t use exit() to terminate a signal handler, because it is not one of safe functions listed in Table 21-1. It is unsafe because it flushes stdio buffers prior to calling _exit(), as described in Section 25.1.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

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

  

Start a Free Trial


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