summaryrefslogtreecommitdiffstats
path: root/src/thread.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-10-05 12:55:56 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-10-05 12:55:56 -0400
commit634359bb169311646f6369b21f0c90a9819fe2ce (patch)
tree0cf7913c96892c35c9aa3526bec096f7ca0b0e4b /src/thread.h
parent14f790c80acf0f9f005ce9e7a94246954533163b (diff)
downloadbfs-634359bb169311646f6369b21f0c90a9819fe2ce.tar.xz
thread: Define thread_local
Diffstat (limited to 'src/thread.h')
-rw-r--r--src/thread.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/thread.h b/src/thread.h
index 45b5e1f..ab95a79 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -8,11 +8,20 @@
#ifndef BFS_THREAD_H
#define BFS_THREAD_H
+#include "config.h"
#include "diag.h"
#include <errno.h>
#include <pthread.h>
#include <string.h>
+#if __STDC_VERSION__ < 202311L && !defined(thread_local)
+# if BFS_USE_THREADS_H
+# include <threads.h>
+# else
+# define thread_local _Thread_local
+# endif
+#endif
+
#define thread_verify(expr, cond) \
bfs_verify((errno = (expr), (cond)), "%s: %s", #expr, strerror(errno))