← Back to team overview

maria-developers team mailing list archive

Do we support compilers that support C++11 but not thread_local?



I'm writing this in connection with MyRocks Storage Engine and

C++ 11 includes "thread_local" specifier : 

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)

but this page page about Visual Studio 2015)  

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?

Sergei Petrunia, Software Developer
MariaDB Corporation | Skype: sergefp | Blog: http://s.petrunia.net/blog

Follow ups