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

Armel Asselin asselin.armel at wanadoo.fr
Fri Aug 11 02:58:16 PDT 2006


> wxThreadSpecificData uses a single slot per object (so you may not create
> more than a few dozens or, at best, few hundreds, of them). However *all*
> thread-specific data used by wx itself (including current wxThread object,
> the log target for this thread and I don't know what else) must use a
> single wxThreadSpecificData which would contain a pointer to wxThreadData
> (this class is internal to the library).
i've got an implementation problem with the one system slot per 
wxThreadSpecificData on Windows.
there is no way to tell to Windows to auto-delete object on thread 
termination (pthread have though)
it means that without a list of the wxThreadSpecificData objects somewhere, 
i cannot free memory on thread termination.

using a basic chaining schema with a static member pointer to first object + 
a member per object to next may be used but we have to handle destruction 
removal from the list correctly because of dynamicly loaded (and 
particularly UN-loaded) libs.
are there systems where dlopen / LoadLibrary calls are not serialized? in 
this case we'd have to protect this list with a critical section.

Armel





More information about the wx-dev mailing list