| 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: | <200501091731.j09HVm9m000706@thor.remedy.nl> |
| From: | "Johnny Willemsen" <jwillemsen AT remedy DOT nl> |
| To: | <cygwin AT cygwin DOT com> |
| Subject: | Problem in pthread_key_create |
| Date: | Sun, 9 Jan 2005 18:31:53 +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,
Posted this last Friday but didn't got anything back. I think this is a bug
in the pthread library of Cygwin. Can someone have a look at this?
Johnny
-----Original Message-----
From: Johnny Willemsen [mailto:jwillemsen AT remedy DOT nl]
Sent: vrijdag 7 januari 2005 14:57
To: 'cygwin AT cygwin DOT com'
Subject: Question about pthread_key_create
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 |