Shared library rework & external async API support

This commit is contained in:
Jarcode
2019-08-28 00:24:59 -07:00
parent 5630e2314b
commit f562bc690d
12 changed files with 322 additions and 114 deletions

26
glava-cli/cli.c Normal file
View File

@@ -0,0 +1,26 @@
#include <glava.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
static renderer_handle handle;
static void handle_term (int _) {
printf("Interrupt recieved, closing...\n");
glava_terminate(&handle);
}
static void handle_reload(int _) {
printf("User signal recieved, reloading...\n");
glava_reload(&handle);
}
int main(int argc, char** argv) {
const struct sigaction term_action = { .sa_handler = handle_term };
const struct sigaction reload_action = { .sa_handler = handle_reload };
sigaction(SIGTERM, &term_action, NULL);
sigaction(SIGINT, &term_action, NULL);
sigaction(SIGUSR1, &reload_action, NULL);
glava_entry(argc, argv, &handle);
return EXIT_SUCCESS;
}