From c31c499372a59c9ff602c58ad5a209192a02c16e Mon Sep 17 00:00:00 2001 From: matt335672 <30179339+matt335672@users.noreply.github.com> Date: Tue, 7 Oct 2025 11:58:35 +0100 Subject: [PATCH] os_calls: Add NULL_WAIT_OBJ The wait_obj calls (mostly) ignore objects with a value of zero. This is codified, so that user code can explicitly make use of this. --- common/os_calls.c | 14 +++++++------- common/os_calls.h | 5 +++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/common/os_calls.c b/common/os_calls.c index 566e9422..350a4136 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -1855,7 +1855,7 @@ g_delete_wait_obj_from_socket(tintptr wait_obj) { #ifdef _WIN32 - if (wait_obj == 0) + if (wait_obj == NULL_WAIT_OBJ) { return; } @@ -1879,7 +1879,7 @@ g_set_wait_obj(tintptr obj) int to_write; char buf[4] = "sig"; - if (obj == 0) + if (obj == NULL_WAIT_OBJ) { return 0; } @@ -1928,7 +1928,7 @@ int g_reset_wait_obj(tintptr obj) { #ifdef _WIN32 - if (obj == 0) + if (obj == NULL_WAIT_OBJ) { return 0; } @@ -1939,7 +1939,7 @@ g_reset_wait_obj(tintptr obj) int error; int fd; - if (obj == 0) + if (obj == NULL_WAIT_OBJ) { return 0; } @@ -1975,7 +1975,7 @@ int g_is_wait_obj_set(tintptr obj) { #ifdef _WIN32 - if (obj == 0) + if (obj == NULL_WAIT_OBJ) { return 0; } @@ -1985,7 +1985,7 @@ g_is_wait_obj_set(tintptr obj) } return 0; #else - if (obj == 0) + if (obj == NULL_WAIT_OBJ) { return 0; } @@ -1999,7 +1999,7 @@ int g_delete_wait_obj(tintptr obj) { #ifdef _WIN32 - if (obj == 0) + if (obj == NULL_WAIT_OBJ) { return 0; } diff --git a/common/os_calls.h b/common/os_calls.h index bb69f9aa..5e536187 100644 --- a/common/os_calls.h +++ b/common/os_calls.h @@ -198,6 +198,11 @@ g_sck_get_peer_description(int sck, void g_sleep(int msecs); int g_pipe(int fd[2]); +// Wait objects with this value are ignored by +// g_set_wait_obj() / g_reset_wait_obj() / g_is_wait_obj_set() / +// g_delete_wait_obj() +#define NULL_WAIT_OBJ (tintptr)0 + tintptr g_create_wait_obj(const char *name); tintptr g_create_wait_obj_from_socket(tintptr socket, int write); void g_delete_wait_obj_from_socket(tintptr wait_obj);