summaryrefslogtreecommitdiff
path: root/sem_trywait.c
diff options
context:
space:
mode:
authorrpj <rpj>2004-10-19 13:24:40 +0000
committerrpj <rpj>2004-10-19 13:24:40 +0000
commit8c8bcc5d1737002a9d153105c16b262d2e201efa (patch)
treeba43c6049cc7e361a3eb875015aeb4032c01c559 /sem_trywait.c
parent45b1b8cb2a6588f9316f780d8cefe11c181a9a17 (diff)
Semaphore speedups - alpha, but passes testsuite
Diffstat (limited to 'sem_trywait.c')
-rw-r--r--sem_trywait.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sem_trywait.c b/sem_trywait.c
index 342ee06..253c10e 100644
--- a/sem_trywait.c
+++ b/sem_trywait.c
@@ -92,8 +92,9 @@ sem_trywait (sem_t * sem)
{
result = EINVAL;
}
- else if (WaitForSingleObject ((*sem)->sem, 0) == WAIT_TIMEOUT)
+ else if (InterlockedDecrement((LPLONG) &(*sem)->value) < 0)
{
+ (void) InterlockedIncrement((LPLONG) &(*sem)->value);
result = EAGAIN;
}