[OLE #65] Free TLS on Thread Destruction
rob at codeweavers.com
Fri Feb 4 11:00:12 CST 2005
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
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).
- 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...
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