summaryrefslogtreecommitdiff
path: root/pthread/pt-internal.h
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2014-02-19 21:30:22 +0100
committerRichard Braun <rbraun@sceen.net>2014-02-19 21:30:22 +0100
commit3b391db91f70b2166951413ee1eccc78cd398a44 (patch)
tree59bf0503bac417c29e4a3a8db699b46180a5ae6d /pthread/pt-internal.h
parent7c6dc6e28b2fc4b67934223f41cf080ffe58b230 (diff)
Make name resolution thread-safe
* pthread/pt-alloc.c (initialize_pthread): Reset resolver state. * pthread/pt-create.c: Include <resolv.h>. (entry_point): Update the __resp TLS variable to point to the resolver state of the current thread. * pthread/pt-internal.h: Define __need_res_state and include <resolv.h>. (struct __pthread): New `res_state' member.
Diffstat (limited to 'pthread/pt-internal.h')
-rw-r--r--pthread/pt-internal.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/pthread/pt-internal.h b/pthread/pt-internal.h
index 7465761..eca63a1 100644
--- a/pthread/pt-internal.h
+++ b/pthread/pt-internal.h
@@ -25,6 +25,8 @@
#include <sched.h>
#include <signal.h>
#include <assert.h>
+#define __need_res_state
+#include <resolv.h>
#include <bits/pt-atomic.h>
@@ -107,6 +109,9 @@ struct __pthread
pthread_mutex_t state_lock; /* Locks the state. */
pthread_cond_t state_cond; /* Signalled when the state changes. */
+ /* Resolver state. */
+ struct __res_state res_state;
+
/* Thread context. */
struct pthread_mcontext mcontext;