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:[EMAIL PROTECTED] Sent: vrijdag 7 januari 2005 14:57 To: 'cygwin@cygwin.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/