|
Boost : |
From: Groke, Paul (paul.groke_at_[hidden])
Date: 2021-01-29 15:13:11
Hi,
I've noticed that Boost.Asio's tss_ptr implementation doesn't use __declspec(thread) on Windows, except when compiling for WinRT.
Instead it uses the win_tss_ptr implementation - which will cause a crash when there's no free TLS index.
(There are static tss_ptr instances and loading a DLL where a ctor of a static variables throws a C++ exception seems to cause a crash -- no surprise there).
AFAIK using implicit TLS via __declspec(thread) should fix this so that loading a DLL either works or fails gracefully.
One problem that I know of with implicit TLS is that it fails catastrophically on Windows versions before Vista. Since WinRT wasn't available on pre-Vista versions, this might be a reason to restrict it to WinRT.
But I don't know if there are/were other reasons to restrict use of implicit TLS to WinRT.
So... is there another reason?
If there's no other reason, that would be great, because we don't have to support pre-Vista versions. Meaning we could simply patch Boost.Asio to use implicit TLS for MSVC in general.
Regards,
Paul Groke
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk