diff options
author | rpj <rpj> | 2002-07-30 17:18:25 +0000 |
---|---|---|
committer | rpj <rpj> | 2002-07-30 17:18:25 +0000 |
commit | d9bad66cbb8823ad786ac480330db1c05e85557a (patch) | |
tree | 512085bea583cab23c9f32646921fbda66aa447d /sem_getvalue.c | |
parent | ccd0f86e370fa71acd47c17cb9579877403c81d1 (diff) |
* pthread_cond_wait.c (ptw32_cond_wait_cleanup):
Remove code designed to avoid/prevent spurious wakeup
problems. It is believed that the sem_timedwait() call
is consuming a CV signal that it shouldn't and this is
breaking the avoidance logic.
Diffstat (limited to 'sem_getvalue.c')
-rw-r--r-- | sem_getvalue.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sem_getvalue.c b/sem_getvalue.c index 9d37c38..4e0402f 100644 --- a/sem_getvalue.c +++ b/sem_getvalue.c @@ -84,10 +84,13 @@ sem_getvalue(sem_t * sem, int * sval) } else { - + register sem_t s = *sem; + #ifdef NEED_SEM - result = ENOSYS; + EnterCriticalSection(&s->sem_lock_cs); + value = s->value; + LeaveCriticalSection(&s->sem_lock_cs); #else @@ -121,7 +124,7 @@ sem_getvalue(sem_t * sem, int * sval) * decrement/increment it inside of sem_wait() and sem_post() * etc using the Interlocked* functions. */ - if ( WaitForSingleObject( (*sem)->sem, 0 ) == WAIT_TIMEOUT ) + if ( WaitForSingleObject( s->sem, 0 ) == WAIT_TIMEOUT ) { /* Failed - must be zero */ value = 0; @@ -129,7 +132,7 @@ sem_getvalue(sem_t * sem, int * sval) else { /* Decremented semaphore - release it and note the value */ - (void) ReleaseSemaphore( (*sem)->sem, 1L, &value); + (void) ReleaseSemaphore( s->sem, 1L, &value); value++; } |