aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/net/getaddrinfo.c
diff options
context:
space:
mode:
authorHajimu UMEMOTO <ume@FreeBSD.org>2005-04-06 15:36:34 +0000
committerHajimu UMEMOTO <ume@FreeBSD.org>2005-04-06 15:36:34 +0000
commit2424b1185195850c1b47db3d46079ef62704ed28 (patch)
treecc2c65bb4388ac2a0fe13a74170056ed74db54a7 /lib/libc/net/getaddrinfo.c
parent1b482912d124eaa5e1c0abb83ef7cc87b9e205f1 (diff)
downloadsrc-2424b1185195850c1b47db3d46079ef62704ed28.tar.gz
src-2424b1185195850c1b47db3d46079ef62704ed28.zip
- we are no longer shareing any resources to be locked between
getaddrinfo(3) and getipnodeby*(3). - use definitions in reentrant.h. - remove obsolete comment.
Notes
Notes: svn path=/head/; revision=144715
Diffstat (limited to 'lib/libc/net/getaddrinfo.c')
-rw-r--r--lib/libc/net/getaddrinfo.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c
index e960743fb895..cbdbcf0b2441 100644
--- a/lib/libc/net/getaddrinfo.c
+++ b/lib/libc/net/getaddrinfo.c
@@ -66,6 +66,7 @@
__FBSDID("$FreeBSD$");
#include "namespace.h"
+#include "reentrant.h"
#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
@@ -84,7 +85,6 @@ __FBSDID("$FreeBSD$");
#include <rpcsvc/yp_prot.h>
#include <rpcsvc/ypclnt.h>
#include <netdb.h>
-#include <pthread.h>
#include <resolv.h>
#include <string.h>
#include <stdlib.h>
@@ -287,16 +287,12 @@ static int res_querydomainN(const char *, const char *,
struct res_target *);
/*
- * XXX: Many dependencies are not thread-safe. So, we share lock between
- * getaddrinfo() and getipnodeby*(). Still, we cannot use
- * getaddrinfo() and getipnodeby*() in conjunction with other
- * functions which call them.
+ * XXX: Many dependencies are not thread-safe. Still, we cannot use
+ * getaddrinfo() in conjunction with other functions which call them.
*/
-pthread_mutex_t __getaddrinfo_thread_lock = PTHREAD_MUTEX_INITIALIZER;
-#define THREAD_LOCK() \
- if (__isthreaded) _pthread_mutex_lock(&__getaddrinfo_thread_lock);
-#define THREAD_UNLOCK() \
- if (__isthreaded) _pthread_mutex_unlock(&__getaddrinfo_thread_lock);
+static mutex_t _getaddrinfo_thread_lock = MUTEX_INITIALIZER;
+#define THREAD_LOCK() mutex_lock(&_getaddrinfo_thread_lock);
+#define THREAD_UNLOCK() mutex_unlock(&_getaddrinfo_thread_lock);
/* XXX macros that make external reference is BAD. */