Hi! For learning purposes, I'll expand a bit on Samuel's brief mid-night email. ;-) (As he wrote, we recently fixed this issue.) On Sat, 9 Jul 2011 12:47:01 +0200, Erik Johansson <debian@ejohansson.se> wrote: > I downloaded a qemu image and spent some time debugging it without any > luck. Everything seems ok, but the destructor is never called. First, thanks for trying! What issues did you struggle on? Did you get the relevant source packages located/built/etc.? That is, is there anything we can do to improve the process? > To see if it was a problem with the pthread implementation I created a > simple test program [2]. The "problem" is that this works, so now I > don't really know where to continue debugging. Yeah. The problem only showed up if there are ``holes'' in the chain of destructor functions; see the test program here: <http://git.savannah.gnu.org/cgit/hurd/libpthread.git/commit/?id=76af844177c2bacd7a39e865cf0bbe484a68ddb8>. A minimal modification of you test program will make this apparent: > #include <pthread.h> > #include <stdio.h> > > void deleter(void* data) > { > printf("in deleter with %p\n", data); > } > > void* threadfn(void* data) > { > pthread_setspecific(*(pthread_key_t*)data, (void*)1); > return NULL; > } > > int main() > { > pthread_key_t key; Here, add: pthread_key_create(&key, deleter); pthread_key_delete(key); Then continue: > pthread_key_create(&key, deleter); > > pthread_t thread; > pthread_create(&thread, 0, threadfn, &key); > pthread_join(thread, 0); > > pthread_key_delete(key); > > return 0; > } Grüße, Thomas
Attachment:
pgp4dbJCBgw1m.pgp
Description: PGP signature