Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 May 2005 06:40:07 GMT
From:      Jens A Nilsson <jnilsson@ludd.ltu.se>
To:        freebsd-threads@FreeBSD.org
Subject:   Re: threads/81258: Thread specific data is sometimes assigned to multiple keys and/or threads
Message-ID:  <200505200640.j4K6e7oc094400@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR threads/81258; it has been noted by GNATS.

From: Jens A Nilsson <jnilsson@ludd.ltu.se>
To: Daniel Eischen <deischen@freebsd.org>
Cc: Jens Nilsson <jnilsson@ludd.luth.se>,
	freebsd-gnats-submit@freebsd.org, freebsd-threads@freebsd.org
Subject: Re: threads/81258: Thread specific data is sometimes assigned to multiple keys and/or threads
Date: Fri, 20 May 2005 06:10:51 +0200

 On Thu, May 19, 2005 at 08:52:23AM -0400, Daniel Eischen wrote:
 > On Thu, 19 May 2005, Jens Nilsson wrote:
 > > Thread specific data is sometimes assinged to multiple keys
 > > and/or threads. In the attached test program two threads getting
 > > the same tsd for the same key seems to be the most usual.
 > >
 > > >How-To-Repeat:
 > > Run the attached test program a couple of times. One of the
 > > threads will wait for input, the bug is most likely to show up if
 > > enter is pressed in about half a second after the thread asked
 > > for data.
 > >
 > > I ran into the bug some time ago while developing a bit more
 > > complex application that involved a couple of threads all of them
 > > with TSD and some doing RPC-calls. In that application I had the
 > > same problem with any of the thread libs libpthread, libthr, and
 > > libc_r. This test program only seems to be able to repeat the
 > > problem with libpthread.
 > 
 > Thread-specific data is destroyed when the thread exits.  Your
 > TSD is allocated using malloc() and destroyed using free().  Your
 > test program does nothing to ensure that all threads have started
 > running and have all created/initialized their TSD before the
 > first thread exits.  malloc() is probably reusing a prior
 > allocation that has been free()'d.
 > 
 > Thread exiting != Thread being joined.
 
 I see, sorry to have bothered you.
 
 -- 
 Regards Jens



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200505200640.j4K6e7oc094400>