delorie.com/archives/browse.cgi | search |
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 |
From: | "Gerald S. Williams" <gsw AT agere DOT com> |
To: | "Andrew T. Schnable" <schnable AT enteract DOT com>, |
"Robert Collins" <robert DOT collins AT itdomain DOT com DOT au>, <cygwin AT cygwin DOT com> | |
Subject: | RE: sem_trywait returns EAGAIN (rather than returning -1 and setting errno) |
Date: | Mon, 4 Mar 2002 11:06:02 -0500 |
Message-ID: | <GBEGLOMMCLDACBPKDIHFGEFLCHAA.gsw@agere.com> |
MIME-Version: | 1.0 |
X-Priority: | 3 (Normal) |
X-MSMail-Priority: | Normal |
X-Mailer: | Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) |
Importance: | Normal |
In-Reply-To: | <001301c1c0a2$1aae73c0$6401a8c0@dopeslap2k> |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.4807.1700 |
Andrew T. Schnable [mailto:schnable AT enteract DOT com] wrote: > I think all the sem_* functions are broken similarly. [ ... ] I just came across this myself while working on enabling Cygwin Python threads. You may find the following function helpful: static int fix_status(int status) { return (status == -1) ? errno : status; } I defined it as a routine rather than a macro so that you can use it on a single line without mistakenly calling the function twice. E.g., status = fix_status(sem_wait(thelock)); This should work for any function that returns 0 for success and -1 for failure (putting the error code in errno), since 0 is never a legal errno code. You may find it useful if you are using pthreads and semaphore code at the same time and want the return codes to work the same. -Jerry -O Gerald S. Williams, 22Y-103GA : mailto:gsw AT agere DOT com O- -O AGERE SYSTEMS, 555 UNION BLVD : office:610-712-8661 O- -O ALLENTOWN, PA, USA 18109-3286 : mobile:908-672-7592 O- -- 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |