mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
os::exit and os::fastexit added.
This commit is contained in:
27
lib/std/os/os.c3
Normal file
27
lib/std/os/os.c3
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user