summaryrefslogtreecommitdiff
path: root/src/exit/quick_exit.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-08-25 22:49:47 -0400
committerRich Felker <dalias@aerifal.cx>2012-08-25 22:49:47 -0400
commitb5289fd749bc4d2637610d712f8fe650f214f1d5 (patch)
tree01384c6a2f5c14b3c909dc98c9552c25e86f6196 /src/exit/quick_exit.c
parenta5d6199d091aad750b1fc325240a141a88ee770e (diff)
downloadmusl-b5289fd749bc4d2637610d712f8fe650f214f1d5.tar.gz
add c11 quick_exit and at_quick_exit functions
Diffstat (limited to 'src/exit/quick_exit.c')
-rw-r--r--src/exit/quick_exit.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/exit/quick_exit.c b/src/exit/quick_exit.c
new file mode 100644
index 00000000..18d5288a
--- /dev/null
+++ b/src/exit/quick_exit.c
@@ -0,0 +1,15 @@
+#include <stdlib.h>
+#include "syscall.h"
+#include "atomic.h"
+#include "libc.h"
+
+static void dummy() { }
+weak_alias(dummy, __funcs_on_quick_exit);
+
+void quick_exit(int code)
+{
+ static int lock;
+ while (a_swap(&lock, 1)) __syscall(SYS_pause);
+ __funcs_on_quick_exit();
+ _Exit(code);
+}