Deleted Added
sdiff udiff text old ( 156953 ) new ( 156956 )
full compact
1#include <port_before.h>
2#ifdef DO_PTHREADS
3#include <pthread.h>
4#endif
5#include <errno.h>
6#include <netdb.h>
7#include <stdlib.h>
8#include <string.h>
9#include <resolv_mt.h>
10#include <irs.h>
11#include <port_after.h>
12
13#ifdef DO_PTHREADS
14static pthread_key_t key;
15static int mt_key_initialized = 0;
16
17static int __res_init_ctx(void);
18static void __res_destroy_ctx(void *);

--- 16 unchanged lines hidden (view full) ---

35 int pthread_keycreate_ret;
36
37 pthread_keycreate_ret = pthread_key_create(&key, __res_destroy_ctx);
38 if (pthread_keycreate_ret == 0)
39 mt_key_initialized = 1;
40}
41#endif
42
43/*
44 * To support binaries that used the private MT-safe interface in
45 * Solaris 8, we still need to provide the __res_enable_mt()
46 * and __res_disable_mt() entry points. They're do-nothing routines.
47 */
48int
49__res_enable_mt(void) {
50 return (-1);
51}
52
53int
54__res_disable_mt(void) {
55 return (0);
56}
57
58#ifdef DO_PTHREADS
59static int
60__res_init_ctx(void) {
61
62 mtctxres_t *mt;
63 int ret;
64

--- 29 unchanged lines hidden (view full) ---

94}
95#endif
96
97mtctxres_t *
98___mtctxres(void) {
99#ifdef DO_PTHREADS
100 mtctxres_t *mt;
101
102 /*
103 * This if clause should only be executed if we are linking
104 * statically. When linked dynamically _mtctxres_init() should
105 * be called at binding time due the #pragma above.
106 */
107 if (!mt_key_initialized) {
108 static pthread_mutex_t keylock = PTHREAD_MUTEX_INITIALIZER;
109 pthread_mutex_lock(&keylock);

--- 19 unchanged lines hidden ---