glib: add internal macro G_THREAD_LOCAL for support for thread local storage

_Thread_local is also C11, so possibly other compilers would also support
it.

However, since not *all* compilers support it, it can anyway only be
used as optimization and conditional asserts. As such, the current
detection based on __GNUC__ to only support gcc (and clang) is good
enough.
This commit is contained in:
Thomas Haller 2023-12-21 12:11:37 +01:00
parent 6c389738d3
commit a12f0731dd

View File

@ -321,4 +321,10 @@ GLibPrivateVTable *glib__private__ (void);
gboolean g_uint_equal (gconstpointer v1, gconstpointer v2);
guint g_uint_hash (gconstpointer v);
#if defined(__GNUC__)
#define G_THREAD_LOCAL __thread
#else
#undef G_THREAD_LOCAL
#endif
#endif /* __GLIB_PRIVATE_H__ */