diff --git a/src/xpdev/semwrap.h b/src/xpdev/semwrap.h index a88f47a87ac4db143452196d2273353eac6e5b91..3e506c572797bc159b664ec587fa30da669f56cd 100644 --- a/src/xpdev/semwrap.h +++ b/src/xpdev/semwrap.h @@ -61,6 +61,7 @@ extern "C" { #include <semaphore.h> /* POSIX semaphores */ #endif + /* NOT POSIX */ int sem_trywait_block(sem_t *sem, unsigned long timeout); #elif defined(_WIN32) @@ -78,6 +79,7 @@ extern "C" { #define sem_destroy(psem) CloseHandle(*(psem)) /* No Win32 implementation for sem_getvalue() */ + /* NOT POSIX */ #define sem_trywait_block(psem,t) (WaitForSingleObject(*(psem),t)==WAIT_OBJECT_0?0:(errno=EAGAIN,-1)) #elif defined(__OS2__) /* These have *not* been tested! */ @@ -95,6 +97,9 @@ extern "C" { #endif +/* Change semaphore to "unsignaled" (NOT POSIX) */ +#define sem_reset(psem) while(sem_trywait(psem)==0) + #if defined(__cplusplus) } #endif