2016-03-29 03:03:54 +02:00
|
|
|
/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */
|
|
|
|
|
|
|
|
#ifndef SE_INCL_THREADLOCALSTORAGE_H
|
|
|
|
#define SE_INCL_THREADLOCALSTORAGE_H
|
|
|
|
#ifdef PRAGMA_ONCE
|
|
|
|
#pragma once
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef SINGLE_THREADED
|
|
|
|
#define THREADLOCAL(type, name, defval) type name = defval
|
|
|
|
#define EXTERNTHREADLOCAL(type, name) extern type name
|
|
|
|
#elif (defined _MSC_VER)
|
|
|
|
#define THREADLOCAL(type, name, defval) type __declspec(thread) name = defval
|
|
|
|
#define EXTERNTHREADLOCAL(type, name) extern type __declspec(thread) name
|
|
|
|
#else
|
2016-04-09 08:18:57 +02:00
|
|
|
// Pretty much everything has __thread now. If it doesn't, do SINGLE_THREADED or
|
|
|
|
// roll something with pthread_key or SDL or whatever. See revision history for a start.
|
|
|
|
#define THREADLOCAL(type, name, defval) __thread type name = defval;
|
|
|
|
#define EXTERNTHREADLOCAL(type, name) extern __thread type name;
|
2016-03-29 03:03:54 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // include-once blocker.
|
|
|
|
|
|
|
|
|
|
|
|
// end of ThreadLocalStorage.h ...
|
|
|
|
|