summaryrefslogtreecommitdiff
path: root/nonstd/static/thread.h
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-02-02 13:12:59 -0500
committerJakob Kaivo <jkk@ung.org>2019-02-02 13:12:59 -0500
commitaa2c7727b1ee7b3747681f6b78f9ef0d36beb749 (patch)
tree2d637999ffbf3661fa5ef2e6e93bf40bff13672f /nonstd/static/thread.h
parenta4bd7a9c848d024ecb9c2bd9af0facaec728ba30 (diff)
trim old nonstd
Diffstat (limited to 'nonstd/static/thread.h')
-rw-r--r--nonstd/static/thread.h39
1 files changed, 0 insertions, 39 deletions
diff --git a/nonstd/static/thread.h b/nonstd/static/thread.h
deleted file mode 100644
index db66c0b7..00000000
--- a/nonstd/static/thread.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 201101L
-
-static struct per_thread *per_thread(void)
-{
- _Thread_local static struct per_thread pt = {0};
- return &pt;
-}
-
-#elif defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 199506L
-#include <pthread.h>
-
-static pthread_key_t __per_thread_key;
-
-static void _make_key(void)
-{
- pthread_key_create(&key, NULL);
-}
-
-static struct per_thread *per_thread(void)
-{
- static pthread_once_t key_once = PTHREAD_ONCE_INIT;
- struct per_thread *pt;
- pthread_once(&key_once, make_key);
- if ((pt = pthread_getspecific(key)) == NULL) {
- pt = calloc(1, sizeof (*pt));
- pthread_setspecific(key, pt);
- }
- return pt;
-}
-
-#else
-
-static struct per_thread *per_thread(void)
-{
- static struct per_thread pt = {0};
- return &pt;
-}
-
-#endif