[OLE #65] Free TLS on Thread Destruction

Robert Shearman rob at codeweavers.com
Fri Feb 4 11:00:12 CST 2005


Hi,

Without the locking changes in this patch, the TLS destruction could 
cause a deadlock as follows:
1. Thread A takes apartment lock for apartment creation.
2. Thread B is exited and so takes the loader lock.
3. Thread A tries to take the loader lock during LoadLibrary during 
CreateWindow
4. Thread B tries to take the apartment lock to destroy the apartment.

This patch eliminates this possibility by not calling any complicated 
functions while the apartment lock is held (where complicated means any 
non-trivial function that isn't a straight wineserver call).

Rob

Changelog:
- Split up apartment creation so that the long code paths that don't 
need locking no longer have locking
- Add special cases for the threads that join apartments but can't 
increase the refcount of the apartment.
- Free TLS storage on thread destruction (including releasing the 
apartment the thread is in, if any, and so making another test pass).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ole65.diff
Type: text/x-patch
Size: 10703 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20050204/f3720bb3/ole65.bin


More information about the wine-patches mailing list