On Saturday 28 August 2010 12:21:52 Andrea Canciani wrote: > On Fri, Aug 27, 2010 at 3:58 PM, Siarhei Siamashka > > Having something like pixman_init()/pixman_cleanup() functions could > > solve all the problems, but it's an API change. Other solutions (using > > atexit(), using mutexes or atomic oparations when initializing > > implementation, putting 'global_implementation' into thread local > > storage, etc.) seem to all have some risk of introducing portability > > issues and/or add extra runtime overhead. > > Would using library ctor/dtor be ok? They should be available both on win32 > (DllMain) and as a gcc attribute and would allow to initialize things in a > very simple way (without having to use any synchronization). > > See: > http://msdn.microsoft.com/en-us/library/ms682583(VS.85).aspx > http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html > > We probably want to implement DllMain on win32 to allocate/free TLS anyway.
Yes, I think it makes sense to give this a try. The constructor attribute is supported since at least gcc 2.95, and it seems to be fine in clang 2.7 too. There's always a risk that this stuff may be broken for some gcc versions or target systems, but we can never know before trying :) -- Best regards, Siarhei Siamashka
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Pixman mailing list Pixman@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pixman