Program termination: Difference between revisions

Content added Content deleted
m (Emacs Lisp: Make code more idiomatic)
m (→‎{{header|Phix}}: syntax coloured)
Line 1,240: Line 1,240:
=={{header|Phix}}==
=={{header|Phix}}==
To terminate the entire application:
To terminate the entire application:
<lang Phix>if error_code!=NO_ERROR then
<!--<lang Phix>(phixonline)-->
<span style="color: #008080;">if</span> <span style="color: #000000;">error_code</span><span style="color: #0000FF;">!=</span><span style="color: #000000;">NO_ERROR</span> <span style="color: #008080;">then</span>
abort(0)
<span style="color: #7060A8;">abort</span><span style="color: #0000FF;">(</span><span style="color: #000000;">0</span><span style="color: #0000FF;">)</span>
end if</lang>
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
To terminate just the current thread:
<!--</lang>-->
<lang Phix>if error_code!=NO_ERROR then
To terminate just the current thread (no threads under pwa/p2js though):
exit_thread(0)
end if</lang>
<!--<lang Phix>-->
<span style="color: #008080;">if</span> <span style="color: #000000;">error_code</span><span style="color: #0000FF;">!=</span><span style="color: #000000;">NO_ERROR</span> <span style="color: #008080;">then</span>
<span style="color: #7060A8;">exit_thread</span><span style="color: #0000FF;">(</span><span style="color: #000000;">0</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<!--</lang>-->
Files will be closed automatically and memory will be freed, however any other cleanup should be invoked manually.<br>
Files will be closed automatically and memory will be freed, however any other cleanup should be invoked manually.<br>
Most of my code has Abort() routines acting as wrappers for final-housekeeping-then-abort().
Most of my code has Abort() routines acting as wrappers for final-housekeeping-then-abort().