diff options
| author | Jakob Kaivo <jkk@ung.org> | 2019-02-25 21:08:46 -0500 |
|---|---|---|
| committer | Jakob Kaivo <jkk@ung.org> | 2019-02-25 21:08:46 -0500 |
| commit | f26bf1396557e4bc739d6a7703099f75bfe2fb99 (patch) | |
| tree | 1ac1d21defcccac8032590aa6bc145b9d8877016 /src/nonstd/__pthread_per_thread.c | |
| parent | 21f6ab11f8554328772ac992ced6947b2b67df65 (diff) | |
fix warning from -Wall
Diffstat (limited to 'src/nonstd/__pthread_per_thread.c')
| -rw-r--r-- | src/nonstd/__pthread_per_thread.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/nonstd/__pthread_per_thread.c b/src/nonstd/__pthread_per_thread.c index 0dff3999..0f633a1b 100644 --- a/src/nonstd/__pthread_per_thread.c +++ b/src/nonstd/__pthread_per_thread.c @@ -1,10 +1,12 @@ +#if defined _POSIX_C_SOURCE && 199506L <= _POSIX_C_SOURCE + #include "pthread.h" static pthread_key_t __per_thread_key; static void __make_key(void) { - pthread_key_create(&key, NULL); + pthread_key_create(&__per_thread_key, NULL); } static struct per_thread *per_thread(void) @@ -12,12 +14,13 @@ 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) { + if ((pt = pthread_getspecific(__per_thread_key)) == NULL) { pt = calloc(1, sizeof (*pt)); - pthread_setspecific(key, pt); + pthread_setspecific(__per_thread_key, pt); } return pt; } +#endif /* LINK(pthread) |
