This is the mail archive of the
mailing list for the Cygwin project.
Re: sem_trywait returns EAGAIN (rather than returning -1 and setting errno)
- From: Christopher Faylor <cgf at redhat dot com>
- To: cygwin at cygwin dot com
- Date: Tue, 26 Feb 2002 01:13:05 -0500
- Subject: Re: sem_trywait returns EAGAIN (rather than returning -1 and setting errno)
- References: <005d01c1be6d$b9c6a2c0$6401a8c0@dopeslap2k>
- Reply-to: cygwin at cygwin dot com
On Mon, Feb 25, 2002 at 09:31:41PM -0500, Andrew T. Schnable wrote:
>I was doing some pthreads/semaphore work and I tracked down a problem
>in my code to a bug in sem_trywait. Posix sem_trywait is defined as
>returning -1 and setting errno to EAGAIN if the semaphore would have
>blocked. The cygwin implementation returns EAGAIN an leaves errno
>Has anyone else encountered this problem and provided a fix?
Hmm. Unless I am missing something, it looks like this problem is
prevalent in the pthreads code. It makes me think that maybe the
author meant to catch these kinds of things in the interface between
the __pthread/pthread calls.
Robert, can you explain what's going on here?
>PS. The problem seems to be in thread.cc (semaphore::TryWait) - I don't see
>stderr setting anywhere in this file - is this verboten - or just
> /*FIXME: signals should be able to interrupt semaphores...
> *We probably need WaitForMultipleObjects here.
> if (WaitForSingleObject (win32_obj_id, 0) == WAIT_TIMEOUT)
> return EAGAIN;
> return 0;
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html