PatchworkOS  966e257
A non-POSIX operating system.
Loading...
Searching...
No Matches
exit_stack.c
Go to the documentation of this file.
1#include "exit_stack.h"
2
3#include <errno.h>
4#include <stdint.h>
5
6static void (*_stack[_EXIT_STACK_SIZE])(void);
7static uint64_t _length = 0;
8
10{
11 _length = 0;
12}
13
14uint64_t _exit_stack_push(void (*func)(void))
15{
17 {
18 return ERR;
19 }
20 else
21 {
22 _stack[_length++] = func;
23 return 0;
24 }
25}
26
28{
29 while (_length != 0)
30 {
31 _stack[--_length]();
32 }
33}
static void(* _stack[_EXIT_STACK_SIZE])(void)
Definition exit_stack.c:6
static uint64_t _length
Definition exit_stack.c:7
void _exit_stack_dispatch(void)
Definition exit_stack.c:27
uint64_t _exit_stack_push(void(*func)(void))
Definition exit_stack.c:14
void _exit_stack_init(void)
Definition exit_stack.c:9
#define _EXIT_STACK_SIZE
Definition exit_stack.h:5
#define ERR
Integer error value.
Definition ERR.h:17
__UINT64_TYPE__ uint64_t
Definition stdint.h:17