Subject: Re: [Threads-devel] BOOST_THREAD_LOCAL support (was: hierarchical_mutex for lock hierarchies)
From: Fredrik Orderud (forderud_at_[hidden])
Date: 2013-02-18 14:16:43
On Mon, Feb 18, 2013 at 1:18 PM, Vicente J. Botet Escriba <
> I have added some comments in
Could you please explain what you meant with your comment regarding
BOOST_THREAD_LOCAL for non-C++11 compilers Vicente?
As far as I can see, more or less "all" compilers (of relevance to boost)
have supported either __declspec(thread) or __thread for quite some years
. I therefore supect that BOOST_THREAD_LOCAL can be implemented with a
small preprocessor block that only has to switch between thread_local,
__declspec(thread) or __thread "backends" (the _MSC_VER check in my patch
should probably be replaced with _WIN32 to also support Intel on windows).
Please correct me if this view is naive.
There are for sure limitations regarding thread-local variables, such as
MSVC not allowing dynamic initialization [2,3], but these limitations can
be documented. Furthermore, we can recommend client code to only use the
functionality subset supported by most/all compilers.