3f7 Subj : Re: thread destructor ala atexit() To : comp.programming.threads From : Frank Cusack Date : Tue Aug 30 2005 04:12 pm On Tue, 30 Aug 2005 14:46:36 -0500 "Chris Thomasson" <_no_spam_cristom@no_spam_comcast._net> wrote: > "Frank Cusack" wrote in message > news:m2d5nvgrsp.fsf@maguro.savecore.net... >> Is there anything like pthread_atexit() which would register a destructor >> to be run when a thread terminates? I have a module which plugs into an >> existing framework. I want to create a thread local variable in my >> module. >> Initializing the variable allocates resources which must be destroyed upon >> thread termination. >> >> But I don't control thread creation and destruction--that's handled within >> the existing framework. >> >> I looked at cancellation but it doesn't seem like it will work. > > http://www.opengroup.org/onlinepubs/007908799/xsh/pthread_key_create.html > > That should do exactly what you want. perfect. -frank . 0