2002-02-28 Robert Collins <rbtcollins@hotmail.com>

* thread.cc (semaphore::TryWait): Set errno as required by posix 1003.1.
        (__sem_wait): Ditto.
        (__sem_trywait): Ditto.
This commit is contained in:
Robert Collins 2002-02-28 13:50:41 +00:00
parent 5c48da9a28
commit 062401c9b4
2 changed files with 18 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2002-02-28 Robert Collins <rbtcollins@hotmail.com>
* thread.cc (semaphore::TryWait): Set errno as required by posix 1003.1.
(__sem_wait): Ditto.
(__sem_trywait): Ditto.
2002-02-27 Christopher Faylor <cgf@redhat.com>
* include/cygwin/version.h: Bump DLL minor number.

View File

@ -807,7 +807,10 @@ semaphore::TryWait ()
*We probably need WaitForMultipleObjects here.
*/
if (WaitForSingleObject (win32_obj_id, 0) == WAIT_TIMEOUT)
return EAGAIN;
{
set_errno (EAGAIN);
return -1;
}
currentvalue--;
return 0;
}
@ -2213,7 +2216,10 @@ int
__sem_wait (sem_t *sem)
{
if (verifyable_object_isvalid (sem, SEM_MAGIC) != VALID_OBJECT)
return EINVAL;
{
set_errno (EINVAL);
return -1;
}
(*sem)->Wait ();
return 0;
@ -2223,7 +2229,10 @@ int
__sem_trywait (sem_t *sem)
{
if (verifyable_object_isvalid (sem, SEM_MAGIC) != VALID_OBJECT)
return EINVAL;
{
set_errno (EINVAL);
return -1;
}
return (*sem)->TryWait ();
}