summaryrefslogtreecommitdiff
path: root/sem_wait.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_wait.c
parent45b1b8cb2a6588f9316f780d8cefe11c181a9a17 (diff)
Semaphore speedups - alpha, but passes testsuite
Diffstat (limited to 'sem_wait.c')
-rw-r--r--sem_wait.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sem_wait.c b/sem_wait.c
index e2e171c..0c2ed59 100644
--- a/sem_wait.c
+++ b/sem_wait.c
@@ -92,8 +92,14 @@ sem_wait (sem_t * sem)
#else /* NEED_SEM */
- result = pthreadCancelableWait ((*sem)->sem);
-
+ sem_t s = *sem;
+
+ if (InterlockedDecrement((LPLONG) &s->value) < 0)
+ {
+ /* Must wait */
+ result = pthreadCancelableWait (s->sem);
+ }
+
#endif /* NEED_SEM */
}