mirror of
https://github.com/janet-lang/janet
synced 2025-12-12 03:28:07 +00:00
Allow configuration of JANET_THREAD_LOCAL. Address #1595
This is to better allow configuration on various, unknown compilers. Previously, we hardcoded how thread local storage was specified for a few different compilers, but we were not following and C standard. In C11, there is a standardized storage specifier _Thread_local for this storage class, however this is now deprecated in various C++ compilers for a new keyword, confusingly. Janet also does not claim to require the C11 standard, so for maximum flexibilty, the storage specifier must be specified at configure time.
This commit is contained in:
@@ -170,14 +170,12 @@ extern "C" {
|
||||
/* Also enable the thread library only if not single-threaded */
|
||||
#ifdef JANET_SINGLE_THREADED
|
||||
#define JANET_THREAD_LOCAL
|
||||
#undef JANET_THREADS
|
||||
#elif defined(__GNUC__)
|
||||
#elif !(defined(JANET_THREAD_LOCAL)) && defined(__GNUC__)
|
||||
#define JANET_THREAD_LOCAL __thread
|
||||
#elif defined(_MSC_BUILD)
|
||||
#elif !(defined(JANET_THREAD_LOCAL)) && defined(_MSC_BUILD)
|
||||
#define JANET_THREAD_LOCAL __declspec(thread)
|
||||
#else
|
||||
#elif !(defined(JANET_THREAD_LOCAL))
|
||||
#define JANET_THREAD_LOCAL
|
||||
#undef JANET_THREADS
|
||||
#endif
|
||||
|
||||
/* Enable or disable dynamic module loading. Enabled by default. */
|
||||
|
||||
Reference in New Issue
Block a user