Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Mon, 10 Jan 2005 13:00:07 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Problem in pthread_key_create Message-ID: <20050110120007.GF7748@cygbert.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <200501091731 DOT j09HVm9m000706 AT thor DOT remedy DOT nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200501091731.j09HVm9m000706@thor.remedy.nl> User-Agent: Mutt/1.4.2i On Jan 9 18:31, Johnny Willemsen wrote: > 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? No, that's not a bug. Please read the SUSv3 description for pthread_key_create() here: http://www.opengroup.org/onlinepubs/009695399/functions/pthread_key_create.html Please note especially the chapter RATIONALE/Non-Idempotent Data Key Creation. It should sufficiently describe why returning EBUSY in this case isn't such a bad idea. Unfortunately, the SUSv3 definition left the actual behaviour open to the implementation. Another implementation could also reset the data key to NULL in subsequent calls to pthread_key_create(). Either way, the bottom line is, don't call pthread_key_create() more than once for the same data key. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader mailto:cygwin AT cygwin DOT com Red Hat, Inc. -- 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/