gtpc2m5bC/C++ Language Support User's Guide

pause-Wait for a Signal

This function suspends the calling process until a signal is delivered.

Format

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

This function does not have any parameters.

Normal Return

The pause function suspends the calling process until a signal causes control to be returned. When a signal is received, if the corresponding signal handler returns control to the calling process, the pause function returns a value of -1 and sets errno to EINTR, which indicates that pause function processing was interrupted by a signal.

Error Return

None.

Programming Considerations

The behavior of the signal handler associated with a signal that occurs while the calling process is suspended can cause the entry control block (ECB) to exit.

Examples

The following example suspends processing until any signal arrives.

#include <signal.h>

·
·
·
{ /* wait for any signal */ pause(); /* we only expect to get control here if pause was */ /* interrupted by a signal for which a signal handler */ /* was called and only if that signal handler returned */
·
·
·
}

Related Information