[wx-dev] wxThread, thread local storage and wxLog

Armel Asselin asselin.armel at wanadoo.fr
Fri Aug 11 06:19:53 PDT 2006


> AA> > AA> i've got an implementation problem with the one system slot per
> AA> > AA> wxThreadSpecificData on Windows.
> AA> >
> AA> > Surely you mean "one slot per all wxThreadSpecificData instances".
> AA> yes that's what I mean.
> AA>
> AA> > AA> there is no way to tell to Windows to auto-delete object on 
> thread
> AA> > AA> termination (pthread have though)
> AA> >
> AA> > What's wrong with doing it from wxThread::Exit()?
> AA> without a list of wxThreadSpecificData instances, I do not know at all 
> which
> AA> to delete during wxThread::Exit
>
> Ok, I think I see what do you mean now: by "delete" you mean "free the
> data stored in the slot", not "deallocate the slot itself", right?
>
> If so, there is indeed no way to do it automatically under Win32
> unfortunately. Maybe the easiest for now would be to not do it at all.
> It can always be added later if really needed.
ok

> AA> I suspect also that wxThread::Exit won't be called for a thread 
> created by
> AA> another application when embedding a wx dll.
>
> No, it won't.
>
> AA> so I must use a static wxThreadSpecificData::Cleanup ( ) call instead.
>
> Rather the code using wxThreadSpecificData from non-wx threads will have
> to do it, yes.
ok so in the different thread.cpp i add a 
wxThreadSpecificData<wxPerThreadData>::Set ((void*)0) to free the data

for wxPerThreadData struct, do you have a preference for the header name? 
wx/tlspriv.h ?

Armel





More information about the wx-dev mailing list