#include <time.h>
#include <stdio.h>
#include <stdlib.h>
+#include <signal.h>
+#include <errno.h>
#include <assert.h>
#include <catta/core.h>
}
}
+static void signal_exit(int signum) {
+ int errnosave = errno;
+ catta_simple_poll_quit(simple_poll);
+ errno = errnosave;
+
+ (void)signum; // ignore
+}
+
int main(CATTA_GCC_UNUSED int argc, CATTA_GCC_UNUSED char*argv[]) {
CattaServerConfig config;
CattaServer *server = NULL;
goto fail;
}
+ /* exit cleanly on signals */
+ signal(SIGINT, signal_exit);
+ signal(SIGTERM, signal_exit);
+
/* Run the main loop */
catta_simple_poll_loop(simple_poll);