diff options
author | Thomas Haller <thaller@redhat.com> | 2022-05-06 10:05:49 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2022-05-06 10:20:16 (GMT) |
commit | 0ea11bee7b974e193ffc34b5b1d7f0d5825b263a (patch) | |
tree | 8e435fddfffa5e5a08707427b220e3a853d9fddb | |
parent | 9b0493646c20f3eecdf664e7e00c6c9162e04fba (diff) | |
download | libnl-0ea11bee7b974e193ffc34b5b1d7f0d5825b263a.zip libnl-0ea11bee7b974e193ffc34b5b1d7f0d5825b263a.tar.gz libnl-0ea11bee7b974e193ffc34b5b1d7f0d5825b263a.tar.bz2 |
utils: add _nl_thread_local macro
-rw-r--r-- | include/netlink-private/utils.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/netlink-private/utils.h b/include/netlink-private/utils.h index dca05b9..93a04c9 100644 --- a/include/netlink-private/utils.h +++ b/include/netlink-private/utils.h @@ -72,6 +72,23 @@ /*****************************************************************************/ +#ifdef thread_local +#define _nl_thread_local thread_local +/* + * Don't break on glibc < 2.16 that doesn't define __STDC_NO_THREADS__ + * see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53769 + */ +#elif __STDC_VERSION__ >= 201112L && \ + !(defined(__STDC_NO_THREADS__) || \ + (defined(__GNU_LIBRARY__) && __GLIBC__ == 2 && \ + __GLIBC_MINOR__ < 16)) +#define _nl_thread_local _Thread_local +#else +#define _nl_thread_local __thread +#endif + +/*****************************************************************************/ + #define _NL_STATIC_ASSERT(cond) ((void) sizeof (char[(cond) ? 1 : -1])) /*****************************************************************************/ |