Handle a signal: Difference between revisions

(Added solution for D)
Line 1,069:
^CTook 6.3437449 seconds.
Aborted</pre>
 
=={{header|Phix}}==
See builtins\pbreak.e for the low-level (inline assembly) cross platform signal handler,
and implementation of the standard hll allow_break() and check_break() routines
<lang Phix>allow_break(false) -- by default Ctrl C terminates the program
puts(1,"Press Ctrl C\n")
atom t = time()
integer i = 1
while 1 do
sleep(0.5)
?i
if check_break() then exit end if
i += 1
end while
printf(1,"The program has run for %3.2f seconds\n",{time()-t})</lang>
{{out}}
<pre>
Press Ctrl C
1
2
3
The program has run for 1.53 seconds
</pre>
 
=={{header|PHP}}==
7,815

edits