diff options
author | Christopher Faylor <me@cgf.cx> | 2013-09-25 14:44:45 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2013-09-25 14:44:45 +0000 |
commit | 1dc2c177f40875f9095dc3a10a5c93ad6eb45934 (patch) | |
tree | 313867e2adc19f38c56a166e81d2c214c63f52a0 | |
parent | 31fb5c643306b16496e97e075495de5b0335f11a (diff) | |
download | cygnal-1dc2c177f40875f9095dc3a10a5c93ad6eb45934.tar.gz cygnal-1dc2c177f40875f9095dc3a10a5c93ad6eb45934.tar.bz2 cygnal-1dc2c177f40875f9095dc3a10a5c93ad6eb45934.zip |
* thread.cc (semaphore::_getvalue): Set *sval as appropriate. Set errno and
return -1 on error.
-rw-r--r-- | winsup/cygwin/ChangeLog | 6 | ||||
-rw-r--r-- | winsup/cygwin/pthread.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/thread.cc | 14 |
3 files changed, 19 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index b1eb36602..c522bd383 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -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 diff --git a/winsup/cygwin/pthread.cc b/winsup/cygwin/pthread.cc index c63c1b8ac..7f12686e7 100644 --- a/winsup/cygwin/pthread.cc +++ b/winsup/cygwin/pthread.cc @@ -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); } diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index 0256ad717..0e0d30127 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -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 |