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

20. Signals: Fundamental Concepts > Waiting for a Signal: pause()

Waiting for a Signal: pause()

Calling pause() suspends execution of the process until the call is interrupted by a signal handler (or until an unhandled signal terminates the process).

#include <unistd.h>

int pause(void);

Note

Always returns -1 with errno set to EINTR

When a signal is handled, pause() is interrupted and always returns -1 with errno set to EINTR. (We say more about the EINTR error in Section 21.5.)

An example of the use of pause() is provided in Example 20-2.

In Waiting for a Signal Using a Mask: sigsuspend() , Synchronously Waiting for a Signal, and Fetching Signals via a File Descriptor, we look at various other ways that a program can suspend execution while waiting for a signal.


  

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