about summary refs log tree commit diff
path: root/resolv/res_libc.c
diff options
context:
space:
mode:
Diffstat (limited to 'resolv/res_libc.c')
-rw-r--r--resolv/res_libc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/resolv/res_libc.c b/resolv/res_libc.c
index c7561c9dc2..9f9af1d701 100644
--- a/resolv/res_libc.c
+++ b/resolv/res_libc.c
@@ -22,8 +22,15 @@
 
 #undef _res
 
+#include <tls.h>
+
+#if USE_TLS && HAVE___THREAD
+/* With __thread support, this per-thread variable is used in all cases.  */
+__thread struct __res_state _res;
+#else
 /* The resolver state for use by single-threaded programs.  */
 struct __res_state _res;
+#endif
 
 /* This function is used to access the resolver state in
    single-threaded programs.  */