pause -- Suspend Execution until a Signal Is Received

SYNOPSIS

 #include <lcsignal.h>

 int pause(void);
 
The synopsis for the POSIX implementation is
 #include <sys/types.h>
 #include <unistd.h>

 int pause(void);
 

You may use either set of header files in your program.

DESCRIPTION

pause suspends program execution until a signal is discovered. If a signal occurs that is blocked, program execution does not resume. If an unblocked signal occurs, pause calls the signal handler, if any, and then immediately returns to its caller.

The pause function may be implemented by OpenEdition or internally by SAS/C. If oesigsetup has been called, explicitly or implicitly, then pause is implemented by OpenEdition; otherwise, it is implemented by SAS/C.

No CPU time is consumed (other than set-up time) while pause is executing.

RETURN VALUE

pause returns - 1, which indicates that it was interrupted by a signal.

CAUTION

A similar function, sigsuspend, allows precise control of signal blocking while pausing, so it is usually preferable to pause.

PORTABILITY

pause is compatible with Berkeley UNIX, except the return value is different.

EXAMPLE

  #include <sys/types.h>
  #include <unistd.h>
  #include <signal.h>
  #include <setjmp.h>
  #include <lcjmp.h>
  #include <stdio.h>

  void breakout(int);
  jmp_buf jbuf;
  int jcode;

  main()
  {
        /* Establish SIGINT handling.    */
     onjmp(jbuf, jcode, done);
     signal(SIGINT, &breakout);
     puts("We are now pausing for a message from our sponsor.");
     puts("Enter Control C or attn to continue.");
     pause();

  done:
     puts("And now back to our program.");
     return;
  }

     /* SIGINT handler gets out of wait. */
  void breakout(int signum)
  {
     puts("Try SAS/C today, the choice of the new generation!");
     longjmp(jbuf, 1);
  }

 

RELATED FUNCTIONS

ecbpause, ecbsuspend, sigpause, sigsuspend, sleep

SEE ALSO


Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.