← Back to team overview

maria-developers team mailing list archive

Re: Do we support compilers that support C++11 but not 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/392/steps/compile/logs/stdio

27.11.2018, 23:07, "Sergey Petrunia" <sergey@xxxxxxxxxxx>:
> 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@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~maria-developers
> More help : https://help.launchpad.net/ListHelp

-- 
Eugene



Follow ups

References