#include <libzth/macros.h>
#include <stdlib.h>
Go to the source code of this file.
|
| void | zth_init () |
| | Perform one-time global initialization of the Zth library.
|
| |
| void | zth_preinit () |
| | Initialization function to be called by the default-supplied main(), before doing anything else.
|
| |
| int | zth_postdeinit () |
| | Initialization function to be called by the default-supplied main(), just before shutting down.
|
| |
| int | zth_run (void(fiber)(void *), void *arg) |
| | Start Zth given the given fiber function.
|
| |
| int | zth_main (int argc, char **argv) |
| | Default main function that runs main_fiber.
|
| |
◆ ZTH_APP_INIT_CALL
◆ ZTH_APP_INIT_CALL_
| #define ZTH_APP_INIT_CALL_ |
( |
|
f, |
|
|
|
... |
|
) |
| |
Value: struct f##__app_init { \
f##__app_init() noexcept \
{ \
__VA_ARGS__ \
} \
}; \
inline f##__app_init const f##__app_init_;
Definition at line 64 of file init.h.
◆ ZTH_DEINIT_CALL
| #define ZTH_DEINIT_CALL |
( |
|
f | ) |
|
Value:
static f##__init f##__deinit_;
#define ZTH_INIT_CALL_(f,...)
Mark the given function f to be invoked during zth_init() .
Mark the given function f to be invoked at exit.
Definition at line 53 of file init.h.
◆ ZTH_INIT_CALL
| #define ZTH_INIT_CALL |
( |
|
f | ) |
|
Value:
static f##__init const f##__init_;
Definition at line 41 of file init.h.
◆ ZTH_INIT_CALL_
| #define ZTH_INIT_CALL_ |
( |
|
f, |
|
|
|
... |
|
) |
| |
Value:
f##__init() noexcept \
{} \
static void exec() { __VA_ARGS__ }; \
};
Mark the given function f to be invoked during zth_init() .
Definition at line 34 of file init.h.
◆ zth_init()
Perform one-time global initialization of the Zth library.
Initialization is only done once. It is safe to call it multiple times.
The initialization sequence is initialized by ZTH_INIT_CALL() and processed in the same order as normal static initializers are executed.
Definition at line 38 of file init.cpp.
◆ zth_main()
| int zth_main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Default main function that runs main_fiber.
Unless main() is defined in the application, this function is called by the default-provided weak main().
Definition at line 104 of file init.cpp.
◆ zth_postdeinit()
Initialization function to be called by the default-supplied main(), just before shutting down.
This function can be used to run machine/board-specific cleanup in main() before returning. The default (weak) implementation does nothing.
- Returns
- the exit code of the application, which overrides the returned value from
main_fiber() when non-zero
Definition at line 24 of file zth_postdeinit.cpp.
◆ zth_preinit()
Initialization function to be called by the default-supplied main(), before doing anything else.
This function can be used to run machine/board-specific initialization in main() even before zth_init() is invoked. The default (weak) implementation does nothing.
Definition at line 22 of file zth_preinit.cpp.
◆ zth_run()
| int zth_run |
( |
void(fiber)(void *) |
, |
|
|
void * |
arg |
|
) |
| |
◆ zth_init_head
◆ zth_init_tail