libobs/util: Add THREAD_LOCAL macro
Adds a thread local storage macro to declare thread local storage independent of platform.
This commit is contained in:
@@ -260,13 +260,8 @@ static bool enabled = false;
|
||||
static pthread_mutex_t root_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static DARRAY(profile_root_entry) root_entries;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
static __declspec(thread) profile_call *thread_context = NULL;
|
||||
static __declspec(thread) bool thread_enabled = true;
|
||||
#else
|
||||
static __thread profile_call *thread_context = NULL;
|
||||
static __thread bool thread_enabled = true;
|
||||
#endif
|
||||
static THREAD_LOCAL profile_call *thread_context = NULL;
|
||||
static THREAD_LOCAL bool thread_enabled = true;
|
||||
|
||||
void profiler_start(void)
|
||||
{
|
||||
|
@@ -78,6 +78,12 @@ EXPORT int os_sem_wait(os_sem_t *sem);
|
||||
|
||||
EXPORT void os_set_thread_name(const char *name);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define THREAD_LOCAL __declspec(thread)
|
||||
#else
|
||||
#define THREAD_LOCAL __thread
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Reference in New Issue
Block a user