diff options
author | deischen <deischen@FreeBSD.org> | 2003-05-04 22:36:46 +0000 |
---|---|---|
committer | deischen <deischen@FreeBSD.org> | 2003-05-04 22:36:46 +0000 |
commit | b9459b93990457e57a289323e1cab3e685ea9b5c (patch) | |
tree | 99ec35f5218201f02e7544eff495375f8ad8cd14 /lib/libc/net/getaddrinfo.c | |
parent | 3cb9ba9e43902d7a4cf096e0b6cd3f12eda1b92c (diff) | |
download | FreeBSD-src-b9459b93990457e57a289323e1cab3e685ea9b5c.zip FreeBSD-src-b9459b93990457e57a289323e1cab3e685ea9b5c.tar.gz |
Replace use of a spinlock with a mutex.
Diffstat (limited to 'lib/libc/net/getaddrinfo.c')
-rw-r--r-- | lib/libc/net/getaddrinfo.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c index e2cb71a..2a8ccae 100644 --- a/lib/libc/net/getaddrinfo.c +++ b/lib/libc/net/getaddrinfo.c @@ -77,6 +77,7 @@ __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> @@ -256,20 +257,17 @@ static char *ai_errlist[] = { "Unknown error", /* EAI_MAX */ }; -/* Make getaddrinfo() thread-safe in libc for use with kernel threads. */ -#include "libc_private.h" -#include "spinlock.h" /* * XXX: Our res_*() is 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 res_*(). */ -spinlock_t __getaddrinfo_thread_lock = _SPINLOCK_INITIALIZER; +pthread_mutex_t __getaddrinfo_thread_lock = PTHREAD_MUTEX_INITIALIZER; #define THREAD_LOCK() \ - if (__isthreaded) _SPINLOCK(&__getaddrinfo_thread_lock); + if (__isthreaded) _pthread_mutex_lock(&__getaddrinfo_thread_lock); #define THREAD_UNLOCK() \ - if (__isthreaded) _SPINUNLOCK(&__getaddrinfo_thread_lock); + if (__isthreaded) _pthread_mutex_unlock(&__getaddrinfo_thread_lock); /* XXX macros that make external reference is BAD. */ |