delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/02/26/19:13:46

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
Message-ID: <001d01c1bf23$bcd8cd10$6401a8c0@dopeslap2k>
From: "Andrew T. Schnable" <schnable AT enteract DOT com>
To: <cygwin AT cygwin DOT com>
References: <FC169E059D1A0442A04C40F86D9BA76008AAC0 AT itdomain003 DOT itdomain DOT net DOT au> <20020226221913 DOT GA20206 AT redhat DOT com>
Subject: Re: sem_trywait returns EAGAIN (rather than returning -1 and setting errno)
Date: Tue, 26 Feb 2002 19:14:35 -0500
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

You have a point regarding errno, but unfortunately, this is how the
standard
is written. If it's intentional that cygwin deviate from posix 1.b, I'm fine
with that - I can code accordingly.  FYI - I went to the

    The Open Group Base Specifications Issue 6
    technically identical to IEEE Std 1003.1-2001
    Copyright © 2001 The IEEE and The Open Group

(because this was easier to find on-line and it should be close enough,)
and snipped this fragment from the sem_trywait man page...

http://www.opengroup.org/onlinepubs/007904975/functions/sem_trywait.html

    RETURN VALUE
    The sem_trywait() and sem_wait() functions shall return zero if the
calling
    process  successfully performed the semaphore lock operation on the
    semaphore designated by  sem. If the call was unsuccessful, the state of
    the semaphore shall be unchanged, and the function shall return a value
    of -1 and set errno to indicate the error.

I reading the wrong version of the standard?  This is how sem_trywait
worked on QNX; Where can I find the cygwin manual pages for the
sem_functions?

Andy

PS. Previous systems I have worked on put errno in thread specific data
making
the code using errno thread safe; the POSIX standard now specifies that
errno can be
something other than an "extern int" - it simply has to be a lvalue - you
can
make errno be a macro that maps to the thread specific data location.

----- Original Message -----
From: "Christopher Faylor" <cgf AT redhat DOT com>
To: <cygwin AT cygwin DOT com>
Sent: Tuesday, February 26, 2002 5:19 PM
Subject: Re: sem_trywait returns EAGAIN (rather than returning -1 and
setting errno)


> On Wed, Feb 27, 2002 at 09:08:54AM +1100, Robert Collins wrote:
> >
> >
> >> -----Original Message-----
> >> From: Christopher Faylor [mailto:cgf AT redhat DOT com]
> >
> >> On Tue, Feb 26, 2002 at 08:37:35PM +1100, Robert Collins wrote:
> >> >The problem should _not_ be endemic in the pthreads code, as
> >> I rewrote
> >> >nearly all the pthread* functions from the P1003.1 draft spec.
> >>
> >> % grep 'return E' thread.cc
> >
> >*Sigh*. That just shows that that is what the code is meant to do.
>
> In other words, RTFM, cgf.  When you think about it, it would make zero
> sense for functions which dealt with threads to set errno.
>
> Sorry about that.  I REALLY should have known better on multiple counts.
>
> (hangs head in shame)
> cgf
>
> --
> 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/
>
>


--
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