Skip to content

Commit

Permalink
Replace WZ_DECL_THREAD with thread_local
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Jul 17, 2023
1 parent 5a5270b commit dac2b64
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
4 changes: 2 additions & 2 deletions lib/framework/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,8 @@ void _realObjTrace(int id, const char *function, const char *str, ...)
// Thread local to prevent a race condition on read and write to this buffer if multiple
// threads log errors. This means we will not be reporting any errors to console from threads
// other than main. If we want to fix this, make sure accesses are protected by a mutex.
static WZ_DECL_THREAD char errorStore[512];
static WZ_DECL_THREAD bool errorWaiting = false;
static thread_local char errorStore[512];
static thread_local bool errorWaiting = false;
const char *debugLastError()
{
if (errorWaiting)
Expand Down
13 changes: 0 additions & 13 deletions lib/framework/wzglobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -520,19 +520,6 @@
#endif


/*! \def WZ_DECL_THREAD
* Declares a variable to be local to the running thread, and not shared between threads.
*/
#if defined(__MACOSX__)
# define WZ_DECL_THREAD // nothing, MacOSX does not yet support this
#elif defined(WZ_CC_GNU) || defined(WZ_CC_INTEL)
# define WZ_DECL_THREAD __thread
#elif defined(WZ_CC_MSVC)
# define WZ_DECL_THREAD __declspec(thread)
#else
# error "Thread local storage attribute required"
#endif

/* ---- Platform specific setup ---- */

#if defined(WZ_OS_WIN)
Expand Down

0 comments on commit dac2b64

Please sign in to comment.