[Pixman] [PATCH] Adding TLS for Windows XP
tschmelcher at google.com
Tue Apr 5 11:04:44 PDT 2011
Oops, I missed this post.
>> We don't want to add another API either. It would be nice to make the library
>> multi-thread safe in Windows XP and no memory leaks at the same time. One
>> question regarding your suggestions of freeing the memory in DLL unload.
>> TlsFree will still need to know all the TLS indices (http://msdn.microsoft.com
>> /en-us/library/ms686804(v=vs.85).aspx) and Pixman core will have that
>> information. So we might still need a new API.
> Isn't it possible to do something similar to what is described here:
> http://msdn.microsoft.com/en-us/library/ms686997%28v=vs.85%29 ?
> As I understand it, we only need one TLS index, which can be stored in a
> global variable in a new pixman-win32.c file. That index is then used
> with TlsSetValue and TlsGetValue to set and get the thread local data,
> and can be released with TlsFree() when DllMain() is acalled with
> Note, I don't really know the Windows API, so I might be
> misunderstanding something here.
Ideally that's what we would want to do. The wrinkle here is that
we're building Pixman as a static library and then linking it into a
DLL with a bunch of other stuff, so our DllMain() needs to do more
than just the Pixman TLS shutdown. So we can't directly call TlsFree
from the DllMain without putting Pixman's TLS index variable into its
headers (which would be a messy refactoring since it's a static global
emitted from a macro). We thought it would be cleanest to add
functions that encapsulate the shutdown logic and call those.
> Pixman mailing list
> Pixman at lists.freedesktop.org
More information about the Pixman