From: Michael Tremer Date: Mon, 11 May 2026 09:02:47 +0000 (+0000) Subject: main: Create an event loop and launch it X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=524f60dc2bf72176632666cd70083c1bccc359e9;p=zone-sync.git main: Create an event loop and launch it Signed-off-by: Michael Tremer --- diff --git a/main.c b/main.c index 443dd28..beb9b5a 100644 --- a/main.c +++ b/main.c @@ -22,6 +22,9 @@ #include #include +#include + +#include #include typedef struct ctx { @@ -29,6 +32,9 @@ typedef struct ctx { // Memory Context isc_mem_t* memctx; + + // Loop Manager + isc_loopmgr_t* loopmgr; } ctx_t; static void logger(ctx_t* ctx, int priority, const char* format, ...) { @@ -133,5 +139,17 @@ int main(int argc, char* argv[]) { // Allocate a new memory context isc_mem_create(&ctx.memctx); + // Initialize the loop manager + isc_loopmgr_create(ctx.memctx, 1, &ctx.loopmgr); + + // Register a callback to be called when the loop starts + isc_loopmgr_setup(ctx.loopmgr, run_loop, &ctx); + + // Run the event loop + isc_loopmgr_run(ctx.loopmgr); + +ERROR: + isc_loopmgr_destroy(&ctx.loopmgr); + return 0; }