summaryrefslogtreecommitdiffstats
path: root/lib/libc/asr/res_init.c
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2016-04-05 04:29:21 +0000
committerguenther <guenther@openbsd.org>2016-04-05 04:29:21 +0000
commitc6cbd3558879ed24f06db5fcaccda4429a1dbfab (patch)
tree48014834b26d2a15e16447fa02bebc44e0045c2a /lib/libc/asr/res_init.c
parentUpdate example in comment: setlogin doesn't use {PROTO,DEF}_WRAP() now (diff)
downloadwireguard-openbsd-c6cbd3558879ed24f06db5fcaccda4429a1dbfab.tar.xz
wireguard-openbsd-c6cbd3558879ed24f06db5fcaccda4429a1dbfab.zip
Prefer _MUTEX_*LOCK over _THREAD_PRIVATE_MUTEX_*LOCK() when thread-specific
data isn't necessary. ok mpi@, ok&tweak natano@
Diffstat (limited to 'lib/libc/asr/res_init.c')
-rw-r--r--lib/libc/asr/res_init.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libc/asr/res_init.c b/lib/libc/asr/res_init.c
index 01a3023bf87..c0a6af3aaec 100644
--- a/lib/libc/asr/res_init.c
+++ b/lib/libc/asr/res_init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: res_init.c,v 1.9 2016/03/23 18:45:03 chrisz Exp $ */
+/* $OpenBSD: res_init.c,v 1.10 2016/04/05 04:29:21 guenther Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -37,7 +37,7 @@ int h_errno;
int
res_init(void)
{
- _THREAD_PRIVATE_MUTEX(init);
+ static void *resinit_mutex;
struct asr_ctx *ac;
int i;
@@ -48,7 +48,7 @@ res_init(void)
* structure from the async context, not overriding fields set early
* by the user.
*/
- _THREAD_PRIVATE_MUTEX_LOCK(init);
+ _MUTEX_LOCK(&resinit_mutex);
if (!(_res.options & RES_INIT)) {
if (_res.retry == 0)
_res.retry = ac->ac_nsretries;
@@ -75,7 +75,7 @@ res_init(void)
_res.nscount = i;
_res.options |= RES_INIT;
}
- _THREAD_PRIVATE_MUTEX_UNLOCK(init);
+ _MUTEX_UNLOCK(&resinit_mutex);
/*
* If the program is not threaded, we want to reflect (some) changes