Handle a signal: Difference between revisions

Content added Content deleted
(→‎{{header|Perl 6}}: make shorter)
m (added whitespace before the TOC (table of contents), added a ;Task: (bold) header.)
Line 1: Line 1:
{{task|Concurrency}} {{requires|Signal handling}} [[Category:Signal handling]]
{{task|Concurrency}}
{{requires|Signal handling}}
[[Category:Signal handling]]
{{omit from|Erlang|Does not handle signals.}}
{{omit from|Erlang|Does not handle signals.}}
{{omit from|Batch File|"Pure" Batch files cannot really handle signals.}}
{{omit from|Batch File|"Pure" Batch files cannot really handle signals.}}
Line 16: Line 18:
Signal handlers are created so that the program behaves in a well-defined manner upon receipt of a signal.
Signal handlers are created so that the program behaves in a well-defined manner upon receipt of a signal.



For this task you will provide a program that displays a single integer
;Task:
on each line of output at the rate of one integer in each half second.
Provide a program that displays a single integer on each line of output at the rate of one integer in each half second.
Upon receipt of the SigInt signal (often created by the user typing ctrl-C) the program will cease printing integers to its output, print the number of seconds

the program has run, and then the program will terminate.
Upon receipt of the SigInt signal (often created by the user typing ctrl-C) the program will cease printing integers to its output, print the number of seconds the program has run, and then the program will terminate.
<br><br>


=={{header|Ada}}==
=={{header|Ada}}==