[Pixman] Valgrind-clean pixman

Siarhei Siamashka siarhei.siamashka at gmail.com
Sun Aug 29 02:19:36 PDT 2010


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/pixman/attachments/20100829/092e67ca/attachment.pgp>


More information about the Pixman mailing list