Nazara now use thread_local (GCC 4.8 is required)
Former-commit-id: 09c0c24ede4a6860acfc71b9532f286bd1381dda
This commit is contained in:
parent
5aeb9d63b8
commit
780bcf122c
|
|
@ -36,22 +36,18 @@
|
||||||
#include <Nazara/Core/Config.hpp>
|
#include <Nazara/Core/Config.hpp>
|
||||||
|
|
||||||
///TODO: Rajouter des tests d'identification de compilateurs
|
///TODO: Rajouter des tests d'identification de compilateurs
|
||||||
// NAZARA_THREADLOCAL n'existe qu'en attendant le support complet de thread_local
|
|
||||||
#if defined(__BORLANDC__)
|
#if defined(__BORLANDC__)
|
||||||
#define NAZARA_COMPILER_BORDLAND
|
#define NAZARA_COMPILER_BORDLAND
|
||||||
#define NAZARA_DEPRECATED(txt)
|
#define NAZARA_DEPRECATED(txt)
|
||||||
#define NAZARA_FUNCTION __FUNC__
|
#define NAZARA_FUNCTION __FUNC__
|
||||||
#define NAZARA_THREADLOCAL __declspec(thread)
|
|
||||||
#elif defined(__clang__)
|
#elif defined(__clang__)
|
||||||
#define NAZARA_COMPILER_CLANG
|
#define NAZARA_COMPILER_CLANG
|
||||||
#define NAZARA_DEPRECATED(txt) __attribute__((__deprecated__(txt)))
|
#define NAZARA_DEPRECATED(txt) __attribute__((__deprecated__(txt)))
|
||||||
#define NAZARA_FUNCTION __PRETTY_FUNCTION__
|
#define NAZARA_FUNCTION __PRETTY_FUNCTION__
|
||||||
#define NAZARA_THREADLOCAL __declspec(thread)
|
|
||||||
#elif defined(__GNUC__) || defined(__MINGW32__)
|
#elif defined(__GNUC__) || defined(__MINGW32__)
|
||||||
#define NAZARA_COMPILER_GCC
|
#define NAZARA_COMPILER_GCC
|
||||||
#define NAZARA_DEPRECATED(txt) __attribute__((__deprecated__(txt)))
|
#define NAZARA_DEPRECATED(txt) __attribute__((__deprecated__(txt)))
|
||||||
#define NAZARA_FUNCTION __PRETTY_FUNCTION__
|
#define NAZARA_FUNCTION __PRETTY_FUNCTION__
|
||||||
#define NAZARA_THREADLOCAL __thread
|
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
#define NAZARA_COMPILER_MINGW
|
#define NAZARA_COMPILER_MINGW
|
||||||
|
|
@ -63,17 +59,14 @@
|
||||||
#define NAZARA_COMPILER_INTEL
|
#define NAZARA_COMPILER_INTEL
|
||||||
#define NAZARA_DEPRECATED(txt)
|
#define NAZARA_DEPRECATED(txt)
|
||||||
#define NAZARA_FUNCTION __FUNCTION__
|
#define NAZARA_FUNCTION __FUNCTION__
|
||||||
#define NAZARA_THREADLOCAL __thread
|
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
#define NAZARA_COMPILER_MSVC
|
#define NAZARA_COMPILER_MSVC
|
||||||
#define NAZARA_DEPRECATED(txt) __declspec(deprecated(txt))
|
#define NAZARA_DEPRECATED(txt) __declspec(deprecated(txt))
|
||||||
#define NAZARA_FUNCTION __FUNCSIG__
|
#define NAZARA_FUNCTION __FUNCSIG__
|
||||||
#define NAZARA_THREADLOCAL __declspec(thread)
|
|
||||||
#else
|
#else
|
||||||
#define NAZARA_COMPILER_UNKNOWN
|
#define NAZARA_COMPILER_UNKNOWN
|
||||||
#define NAZARA_DEPRECATED(txt)
|
#define NAZARA_DEPRECATED(txt)
|
||||||
#define NAZARA_FUNCTION __func__ // __func__ est standard depuis le C++11
|
#define NAZARA_FUNCTION __func__ // __func__ est standard depuis le C++11
|
||||||
#define NAZARA_THREADLOCAL thread_local
|
|
||||||
#error This compiler is not fully supported
|
#error This compiler is not fully supported
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
NAZARA_THREADLOCAL const NzContext* currentContext = nullptr;
|
thread_local const NzContext* currentContext = nullptr;
|
||||||
NAZARA_THREADLOCAL const NzContext* threadContext = nullptr;
|
thread_local const NzContext* threadContext = nullptr;
|
||||||
|
|
||||||
std::vector<NzContext*> contexts;
|
std::vector<NzContext*> contexts;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue