os::exit and os::fastexit added.

This commit is contained in:
Christoffer Lerno
2025-03-20 13:36:59 +01:00
parent d2c44717f1
commit 207bcfea02
5 changed files with 37 additions and 8 deletions

27
lib/std/os/os.c3 Normal file
View File

@@ -0,0 +1,27 @@
module std::os;
import libc;
<*
Exit the process with a given exit code. This will typically call 'exit' in LibC
*>
fn void exit(int result, bool cleanup = true) @weak
{
$if env::LIBC:
libc::exit(result);
$else
$$trap();
$endif
}
<*
Exit the process with a given exit code. This will typically call '_Exit' in LibC
usually bypassing '@finalizer' functions.
*>
fn void fastexit(int result, bool cleanup = true) @weak
{
$if env::LIBC:
libc::_exit(result);
$else
$$trap();
$endif
}