maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #11549
Do we support compilers that support C++11 but not thread_local?
Hi,
I'm writing this in connection with MyRocks Storage Engine and
https://github.com/facebook/mysql-5.6/issues/904
C++ 11 includes "thread_local" specifier :
https://en.cppreference.com/w/cpp/keyword/thread_local
GNU also has __thread, which was available before C++11.
RocksDB (and so MyRocks) uses both __thread and thread_local. thread_local is
part of the standard, so they might switch to thread_local.
The question: will it cause any issues for us?
In other words, do we have compilers/environments that
- claim to support C++11 (so that we attempt to compile MyRocks)
- but do not support "thread_local"
?
For Windows, RocksDB does this in port/win/port_win.h:
#ifndef __thread
#define __thread __declspec(thread)
#endif
but this page page about Visual Studio 2015)
https://msdn.microsoft.com/en-us/library/6yh4a9k1.aspx
says that
C++11: The thread_local storage class specifier is the recommended
way to specify thread-local storage for objects and class members.
I assume this means it's ok to use thread_local on Windows?
RocksDB source code mentions one problematic case:
// However, thread_local is not supported in all compilers that accept -std=c++11
// (e.g., eg Mac with XCode < 8. XCode 8+ supports thread_local).
As far as I understand this is not relevant for us?
Anyone aware of other such cases?
BR
Sergei
--
Sergei Petrunia, Software Developer
MariaDB Corporation | Skype: sergefp | Blog: http://s.petrunia.net/blog
Follow ups