Program termination: Difference between revisions
m
→{{header|Phix}}: syntax coloured
m (Emacs Lisp: Make code more idiomatic) |
m (→{{header|Phix}}: syntax coloured) |
||
Line 1,240:
=={{header|Phix}}==
To terminate the entire application:
<!--<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;">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:▼
▲To terminate just the current thread (no threads under pwa/p2js though):
<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>
Most of my code has Abort() routines acting as wrappers for final-housekeeping-then-abort().
|