summaryrefslogtreecommitdiff
path: root/src/exit/quick_exit.c
blob: 18d5288a709faabc773297590676a7281094165d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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);
}