[Pixman] [cairo] Problem in pthread-specific thread-local storage macros in pixman?

Soeren Sandmann sandmann at daimi.au.dk
Tue Apr 6 22:51:12 PDT 2010


Hi,

You are absolutely right. This didn't work, and the key parameter was
not needed at all.

Further, the thread local variable needs to be initialized with
calloc() and not malloc(). There are fixes in the tls-fixes branch of
this repository:

        git://anongit.freedesktop.org/~sandmann/pixman 

If you can try them out, I'd appreciate it.

A related question: Is there any support in the Windows versions of
GCC for either __thread or __declspec(thread)?


Thanks,
Soren


Tor Lillqvist <tml at iki.fi> writes:

> Look at the pthread-specific implementation of
> PIXMAN_DEFINE_THREAD_LOCAL and PIXMAN_GET_THREAD_LOCAL in
> pixman-compiler.h.
> 
> (For better readability, I leave out the ## operators below and just
> paste in "name".)
> 
> In tls_name_get(), shouldn't the call to tls_name_alloc() pass it
> tls_name_key, not key?
> 
> PIXMAN_GET_THREAD_LOCAL() passes
> tls_name_key as the parameter to tls_name_get(), but the first time it
> is called, tls_name_key hasn't been assigned any value yet.
> 
> Thus, the key parameter of tls_name_get() is actually not needed at all?
> 
> --tml
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo


More information about the Pixman mailing list