On Mon, Feb 18, 2013 at 1:18 PM, Vicente J. Botet Escriba <vicente.botet@wanadoo.fr> wrote:
I have added some comments in https://svn.boost.org/trac/boost/ticket/8094#comment:1.

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 [1]. 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.

Regards,
Fredrik

[1] http://en.wikipedia.org/wiki/Thread-local_storage#C.2B.2B
[2] http://msdn.microsoft.com/en-us/library/2s9wt68x.aspx
[3] http://msdn.microsoft.com/en-us/library/9zxe5aww.aspx