Jump to content

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>if error_code!=NO_ERROR then(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:
end if<!--</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 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>
Most of my code has Abort() routines acting as wrappers for final-housekeeping-then-abort().
7,806

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.