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.
This commit is contained in:
matt335672
2025-10-07 11:58:35 +01:00
parent 64a7c13a77
commit c31c499372
2 changed files with 12 additions and 7 deletions
+7 -7
View File
@@ -1855,7 +1855,7 @@ g_delete_wait_obj_from_socket(tintptr wait_obj)
{ {
#ifdef _WIN32 #ifdef _WIN32
if (wait_obj == 0) if (wait_obj == NULL_WAIT_OBJ)
{ {
return; return;
} }
@@ -1879,7 +1879,7 @@ g_set_wait_obj(tintptr obj)
int to_write; int to_write;
char buf[4] = "sig"; char buf[4] = "sig";
if (obj == 0) if (obj == NULL_WAIT_OBJ)
{ {
return 0; return 0;
} }
@@ -1928,7 +1928,7 @@ int
g_reset_wait_obj(tintptr obj) g_reset_wait_obj(tintptr obj)
{ {
#ifdef _WIN32 #ifdef _WIN32
if (obj == 0) if (obj == NULL_WAIT_OBJ)
{ {
return 0; return 0;
} }
@@ -1939,7 +1939,7 @@ g_reset_wait_obj(tintptr obj)
int error; int error;
int fd; int fd;
if (obj == 0) if (obj == NULL_WAIT_OBJ)
{ {
return 0; return 0;
} }
@@ -1975,7 +1975,7 @@ int
g_is_wait_obj_set(tintptr obj) g_is_wait_obj_set(tintptr obj)
{ {
#ifdef _WIN32 #ifdef _WIN32
if (obj == 0) if (obj == NULL_WAIT_OBJ)
{ {
return 0; return 0;
} }
@@ -1985,7 +1985,7 @@ g_is_wait_obj_set(tintptr obj)
} }
return 0; return 0;
#else #else
if (obj == 0) if (obj == NULL_WAIT_OBJ)
{ {
return 0; return 0;
} }
@@ -1999,7 +1999,7 @@ int
g_delete_wait_obj(tintptr obj) g_delete_wait_obj(tintptr obj)
{ {
#ifdef _WIN32 #ifdef _WIN32
if (obj == 0) if (obj == NULL_WAIT_OBJ)
{ {
return 0; return 0;
} }
+5
View File
@@ -198,6 +198,11 @@ g_sck_get_peer_description(int sck,
void g_sleep(int msecs); void g_sleep(int msecs);
int g_pipe(int fd[2]); 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(const char *name);
tintptr g_create_wait_obj_from_socket(tintptr socket, int write); tintptr g_create_wait_obj_from_socket(tintptr socket, int write);
void g_delete_wait_obj_from_socket(tintptr wait_obj); void g_delete_wait_obj_from_socket(tintptr wait_obj);