* thread.cc (semaphore::_getvalue): Set *sval as appropriate. Set errno and

return -1 on error.
This commit is contained in:
Christopher Faylor 2013-09-25 14:44:45 +00:00
parent 31fb5c6433
commit 1dc2c177f4
3 changed files with 19 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2013-09-25 Christopher Faylor <me.cygwin2013@cgf.cx>
Paul Kunysch <paul.kunysch@emsys.de>
* thread.cc (semaphore::_getvalue): Set *sval as appropriate. Set
errno and return -1 on error.
2013-08-31 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Belatedly bump

View File

@ -185,7 +185,7 @@ sem_timedwait (sem_t * sem, const struct timespec *abstime)
}
int
sem_post (sem_t * sem)
sem_post (sem_t *sem)
{
return semaphore::post (sem);
}

View File

@ -3443,9 +3443,19 @@ semaphore::_getvalue (int *sval)
status = NtQuerySemaphore (win32_obj_id, SemaphoreBasicInformation, &sbi,
sizeof sbi, NULL);
int res;
if (NT_SUCCESS (status))
return sbi.CurrentCount;
return startvalue;
{
*sval = sbi.CurrentCount;
res = 0;
}
else
{
*sval = startvalue;
__seterrno_from_nt_status (status);
res = -1;
}
return res;
}
int