Handle a signal: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: added a comment to the output showing where and when the user pressed the Crtl-C buttons.) |
(Add BaCon) |
||
Line 148: | Line 148: | ||
6 |
6 |
||
Task took 3.526 Seconds</pre> |
Task took 3.526 Seconds</pre> |
||
=={{header|BaCon}}== |
|||
<lang freebasic>' Handle signal |
|||
SUB Finished |
|||
SIGNAL SIG_DFL, SIGINT : ' Restore SIGINT to default |
|||
PRINT "Running for", TIMER / 1000.0, "seconds" FORMAT "%s %f %s\n" |
|||
STOP SIGINT : ' Send another terminating SIGINT |
|||
ENDSUB |
|||
SIGNAL Finished, SIGINT |
|||
iter = 1 |
|||
passed = TIMER |
|||
WHILE TRUE |
|||
IF TIMER > passed + 500 THEN |
|||
PRINT iter |
|||
passed = TIMER |
|||
iter = iter + 1 |
|||
ENDIF |
|||
WEND</lang> |
|||
{{out}} |
|||
<pre>$ ./handle-signal |
|||
1 |
|||
2 |
|||
3 |
|||
^CRunning for 1.766000 seconds</pre> |
|||
=={{header|BBC BASIC}}== |
=={{header|BBC BASIC}}== |