[Previous]
[Contents]
[Next]

pause()

suspend the process until delivery of a signal

Synopsis:

#include <unistd.h>
int pause( void );

Description:

The pause() function suspends the calling process until delivery of a signal whose action is either to execute a signal handler or to terminate the process.

If the action is to terminate the process, pause() does not return. If the action is to execute a signal handler, pause() returns after the signal handler returns.

Returns:

Upon error, pause() returns -1 and sets errno to EINTR, otherwise this function never returns.

Examples:

#include <stdio.h>
#include <unistd.h>

void main()
  {

    /* set an alarm to go off in 5 seconds */
    alarm( 5 );

    /*
     * Wait until we receive a SIGALRM signal. However,
     * since we do not have a signal handler, any signal
     * will kill us.
     */
    printf( "Hang around, "
        " waiting to die in 5 seconds\n" );
    pause();
  }

Classification:

POSIX 1003.1

Safety:
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

alarm(), errno, sigaction()


[Previous]
[Contents]
[Next]