Available in:
Apps (win)
Apps (char)
Reportwriter
RPC
Standalone PL
X
X
X
X
X
void signal(signal[,trigger]) int signal code trigger
signal | specifies the signal number.
|
trigger | (optional) specifies the code to execute when the signal is received. |
{ int i,j; trigger t1 = { printf("Signal caught/escaping"); escape(); }; trigger t2 = { printf("Signal caught/returning"); }; i = to_int(prompt("Enter signum: ")); /*****************************************************************************/ /* Set the handler. */ /*****************************************************************************/ for (j=0;j<3;j++) { if (trap({ signal(i,t1); prompt("Let's wait (" ^^ j ^^ ") escape ... "); })); } /*****************************************************************************/ /* If you get the signal now, the process will exit. */ /*****************************************************************************/ signal(i); prompt("Let's wait ... no signal handler"); /*****************************************************************************/ /* Set the handler. */ /*****************************************************************************/ signal(i,t2); for (j=0;j<3;j++) { prompt("Let's wait (" ^^ j ^^ ") return ... "); } printf("All done"); }