[Maria-developers] Do we support compilers that support C++11 but not thread_local?
![](https://secure.gravatar.com/avatar/c7422c379fec4aa4d99a8a137bf10594.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/bfdc37143fca4e3ec1d50d8c7e133b60.jpg?s=120&d=mm&r=g)
Hi.
This page may be useful for you https://en.cppreference.com/w/cpp/compiler_support
It says that until gcc 4.8 support is partial. And I can see a buildbot for 10.4 with gcc 4.4.6 http://buildbot.askmonty.org/buildbot/builders/kvm-bintar-centos6-x86/builds...
27.11.2018, 23:07, "Sergey Petrunia"
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
_______________________________________________ Mailing list: https://launchpad.net/~maria-developers Post to : maria-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-developers More help : https://help.launchpad.net/ListHelp
-- Eugene
![](https://secure.gravatar.com/avatar/591ffa8a19b4ac6896bd328b34e9f49e.jpg?s=120&d=mm&r=g)
We only build MyRocks on gcc 4.8+, clang 3.3+, or MSVC 19.0+ ( cf. https://github.com/MariaDB/server/blob/10.4/storage/rocksdb/CMakeLists.txt#L...)
all of which have thread_local support, as per https://en.cppreference.com/w/cpp/compiler_support
To me it seems like safe to use C++11 feature, in MyRocks
From: Eugene Kosov
Sent: Tuesday, November 27, 2018 9:44 PM
To: Sergey Petrunia; maria-developers
Cc: Vicențiu Ciorbaru; Vladislav Vaintroub
Subject: Re: [Maria-developers] Do we support compilers that support C++11 butnot thread_local?
Hi.
This page may be useful for you https://en.cppreference.com/w/cpp/compiler_support
It says that until gcc 4.8 support is partial. And I can see a buildbot for 10.4 with gcc 4.4.6 http://buildbot.askmonty.org/buildbot/builders/kvm-bintar-centos6-x86/builds...
27.11.2018, 23:07, "Sergey Petrunia"
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
_______________________________________________ Mailing list: https://launchpad.net/~maria-developers Post to : maria-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-developers More help : https://help.launchpad.net/ListHelp
-- Eugene
participants (3)
-
Eugene Kosov
-
Sergey Petrunia
-
Vladislav Vaintroub