summaryrefslogtreecommitdiff
path: root/sem_post.c
diff options
context:
space:
mode:
Diffstat (limited to 'sem_post.c')
-rw-r--r--sem_post.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sem_post.c b/sem_post.c
index 3281643..1d607e8 100644
--- a/sem_post.c
+++ b/sem_post.c
@@ -85,7 +85,8 @@ sem_post (sem_t * sem)
#else /* NEED_SEM */
- else if (!ReleaseSemaphore ((*sem)->sem, 1, 0))
+ else if (InterlockedExchangeAdd((LPLONG) &(*sem)->value, (LONG) 1) < 0
+ && !ReleaseSemaphore((*sem)->sem, 1, NULL))
#endif /* NEED_SEM */