From owner-freebsd-hackers@FreeBSD.ORG Sun Jan 7 19:36:51 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1AD0316A403 for ; Sun, 7 Jan 2007 19:36:51 +0000 (UTC) (envelope-from dmw@unete.cl) Received: from qmail1.ifxnetworks.com (qmail1.ifxnetworks.com [200.110.128.7]) by mx1.freebsd.org (Postfix) with ESMTP id B8B7013C455 for ; Sun, 7 Jan 2007 19:36:50 +0000 (UTC) (envelope-from dmw@unete.cl) Received: (qmail 24997 invoked from network); 7 Jan 2007 19:36:49 -0000 X-Spam-DCC: sonic.net: qmail1.ifxnetworks.com 1156; Body=1 Fuz1=1 Fuz2=1 X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on qmail1.ifxnetworks.com X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.7 Received: from host181.200.73.29.dynamic.ifxnw.cl (HELO daemon) (dmw@unete.cl@[200.73.29.181]) (envelope-sender ) by qmail1.ifxnetworks.com (qmail-ldap-1.03) with SMTP for ; 7 Jan 2007 19:36:49 -0000 From: Daniel Molina Wegener Organization: DMW To: freebsd-hackers@freebsd.org, Daniel Eischen Date: Sun, 7 Jan 2007 16:36:57 -0300 User-Agent: KMail/1.9.1 References: <200701070834.21711.dmw@unete.cl> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200701071636.57861.dmw@unete.cl> Cc: Subject: Re: strange pthread keys behavior X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: dmw@unete.cl List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2007 19:36:51 -0000 On Sunday 07 January 2007 12:44, Daniel Eischen wrote: > [SNIP] > > > > =BFIs this a mistake in the code or a standard warning in > > FreeBSD pthreads? > > Yes, it looks like a buggy program... > > > The code bellow can be compiled with and do not use the > > pthread_key_delete routine: > > See the POSIX spec with regard to pthread_key_create(): > > =20 > http://www.opengroup.org/onlinepubs/009695399/functions/pthre >ad_key_create.html > > You may have to create an account (free) in order to view it. > Also look at pthread_key_delete(). > > I think the problem is that you are calling > pthread_key_delete() from the thread that is creating the key > and before the thread has exited (when the thread-specific > key data is destroyed). You have invalidated the key by > deleting it, so when the thread exits, it can't call the > destructor and it iterates PTHREAD_KEY_MAX times trying to > deallocate the key data. That is where the error message is > generated. Thanks, really... Best regards... =2D-=20 . 0 . | Daniel Molina Wegener . . 0 | dmw at unete dot cl 0 0 0 | FreeBSD User