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://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Message-Id: | <200501071357.j07DvJ9m021697@thor.remedy.nl> |
From: | "Johnny Willemsen" <jwillemsen AT remedy DOT nl> |
To: | <cygwin AT cygwin DOT com> |
Subject: | Question about pthread_key_create |
Date: | Fri, 7 Jan 2005 14:57:20 +0100 |
MIME-Version: | 1.0 |
X-Spam-Status: | No, hits=0.7 required=5.0 tests=FORGED_MUA_OUTLOOK,MISSING_OUTLOOK_NAME,MSGID_HAS_NO_AT version=2.55 |
X-Spam-Checker-Version: | SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) |
Hi all, A question, I had a look at the implementation of pthread_key_create. When an invalid key is passed, a EBUSY is returned. This looks very strange to me, isn't it better to return EINVAL just as the pthread_key_delete does? Also, shouldn't be the check be if (!pthread_key::is_good_object (key)) return EINVAL; Note the !, when previously a good key was passed, we got back a EBUSY. Regards, Johnny Willemsen Remedy IT Leeghwaterstraat 25 2811 DT Reeuwijk The Netherlands www.theaceorb.nl / www.remedy.nl * Thread Specific Data */ extern "C" int pthread_key_create (pthread_key_t *key, void (*destructor) (void *)) { /* The opengroup docs don't define if we should check this or not, but creation is relatively rare. */ if (pthread_key::is_good_object (key)) return EBUSY; *key = new pthread_key (destructor); if (!pthread_key::is_good_object (key)) { delete (*key); *key = NULL; return EAGAIN; } return 0; } extern "C" int pthread_key_delete (pthread_key_t key) { if (!pthread_key::is_good_object (&key)) return EINVAL; delete (key); return 0; } -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |