From e46c5a1042bb1e0f0d437723c32b16b9ff51566c Mon Sep 17 00:00:00 2001 From: Francesco Cozzuto Date: Sat, 13 Apr 2024 00:33:36 +0200 Subject: [PATCH] Add io_context argument to the callback --- io.c | 2 +- io.h | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/io.c b/io.c index ec347c7..30d0b6a 100644 --- a/io.c +++ b/io.c @@ -1017,7 +1017,7 @@ void io_wait(struct io_context *ioc, if (res->callback == NULL) break; - res->callback(*ev); + res->callback(ioc, *ev); } } diff --git a/io.h b/io.h index 727051d..74d3ca9 100644 --- a/io.h +++ b/io.h @@ -81,14 +81,16 @@ struct io_event { }; }; +struct io_context; + +typedef void (*io_callback)(struct io_context *ioc, struct io_event); + enum io_restype { IO_RES_VOID, IO_RES_FILE, IO_RES_SOCKET, }; -typedef void (*io_callback)(struct io_event); - struct io_resource { enum io_restype type; io_os_handle os_handle;