delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/02/26/01:14:04

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Tue, 26 Feb 2002 01:13:05 -0500
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: sem_trywait returns EAGAIN (rather than returning -1 and setting errno)
Message-ID: <20020226061305.GA7735@redhat.com>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <005d01c1be6d$b9c6a2c0$6401a8c0 AT dopeslap2k>
Mime-Version: 1.0
In-Reply-To: <005d01c1be6d$b9c6a2c0$6401a8c0@dopeslap2k>
User-Agent: Mutt/1.3.23.1i

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
>unchanged.
>
>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?

cgf

>Andy
>schnable AT enteract DOT com
>
>PS. The problem seems to be in thread.cc (semaphore::TryWait) -  I don't see
>much
>stderr setting anywhere in this file - is this verboten - or just
>overlooked?
>
>
>int
>semaphore::TryWait ()
>{
>  /*FIXME: signals should be able to interrupt semaphores...
>   *We probably need WaitForMultipleObjects here.
>   */
>  if (WaitForSingleObject (win32_obj_id, 0) == WAIT_TIMEOUT)
>    return EAGAIN;
>  currentvalue--;
>  return 0;
>}

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019