common: Replace __threadlocal with C++11 thread_local

This commit is contained in:
KousukeItsagame 2017-04-13 19:59:00 +02:00 committed by Gregory Hainaut
parent 3b97137ccf
commit 11aebe465f
5 changed files with 4 additions and 5 deletions

1
.gitignore vendored
View File

@ -112,3 +112,4 @@ oprofile_data/
/tools/bin
/tools/GSDumpGUI/bin
/tools/GSDumpGUI/obj
/.vs

View File

@ -168,7 +168,6 @@ static const int __pagesize = PCSX2_PAGESIZE;
#define PCSX2_ALIGNED16_EXTERN(x) extern __declspec(align(16)) x
#define __noinline __declspec(noinline)
#define __threadlocal __declspec(thread)
// Don't know if there are Visual C++ equivalents of these.
#define likely(x) (!!(x))
@ -216,7 +215,6 @@ static const int __pagesize = PCSX2_PAGESIZE;
#ifndef __noinline
#define __noinline __attribute__((noinline))
#endif
#define __threadlocal __thread
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#endif

View File

@ -18,7 +18,7 @@
#include "Threading.h"
#if PCSX2_THREAD_LOCAL
#define DeclareTls(x) __threadlocal x
#define DeclareTls(x) thread_local x
#else
#define DeclareTls(x) Threading::TlsVariable<x>
#endif

View File

@ -53,7 +53,7 @@ enum XMMSSEType {
#ifndef __tls_emit
#if x86EMIT_MULTITHREADED
#define __tls_emit __threadlocal
#define __tls_emit thread_local
#else
// Using TlsVariable is sub-optimal and could result in huge executables, so we
// force-disable TLS entirely, and disallow running multithreaded recompilation

View File

@ -678,7 +678,7 @@ wxAppWithHelpers::wxAppWithHelpers()
// FS segment register won't have been initialized by the main exe, due to tls_insurance
// being optimized away >_< --air
static __threadlocal int tls_insurance = 0;
static thread_local int tls_insurance = 0;
tls_insurance = 1;
#endif
}