Skip to content

Commit

Permalink
common: Replace __threadlocal with C++11 thread_local
Browse files Browse the repository at this point in the history
  • Loading branch information
KousukeItsagame authored and gregory38 committed Apr 13, 2017
1 parent 3b97137 commit 11aebe4
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,4 @@ oprofile_data/
/tools/bin
/tools/GSDumpGUI/bin
/tools/GSDumpGUI/obj
/.vs
2 changes: 0 additions & 2 deletions common/include/Pcsx2Defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion common/include/Utilities/TlsVariable.inl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion common/include/x86emitter/x86types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion common/src/Utilities/wxAppWithHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 11aebe4

Please sign in to comment.