Shared library rework & external async API support
This commit is contained in:
26
glava-cli/cli.c
Normal file
26
glava-cli/cli.c
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user