Subject: Re: Are res_send and res_query thread-safe?
To: Emmanuel Dreyfus <manu@netbsd.org>
From: Love <lha@stacken.kth.se>
List: tech-userlevel
Date: 04/03/2004 22:09:20
--=-=-=


manu@netbsd.org (Emmanuel Dreyfus) writes:

> Right. So there are no way of performing two DNS lookups at the same
> time from the same process?
>
> One solution is to serialize the lookups using locks, but that is not a
> very good option since a DNS lookup can take several seconds. 

That is the only solution, application shouldn't assume res_search is
treadsafe/re-enterat. But see comment below.

> Do I get a fix by linking with BIND8 resolver? (or BIND9? Is BIND8
> resolver thread safe?) Is it possible? Won't that clash at link time
> with the resolver function available in libc?

You program/library have to use res_ninit/res_nsearch that is part of the
bind8/9 api.

Love


--=-=-=
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (NetBSD)

iQEVAwUAQG8Z8nW+NPVfDpmCAQI0igf/eRuy3oyC/riFCe3hT/d/F8RBg+D+f4S/
nhAQYv7Yhmzbp3l3cqlz3SXGyMA4gKx61+T7VuHnin/d8E4GCJJTgrG7VnUnHuCU
uqNE3cYZd3VFujk/YWY/850fuVXHaIy/5NN6aZwpnqNwsDTPnyDUGIIVpGxwEYEw
SeL4ehwk6E+5sK4Yo2WFVt0/Li6Sy5w5teGKXZ8ZMhTPDyEIZ8TB85TjB194KL+C
hlIzQmRqtUARiYzdfohc7KwOoJbRNXN4zgNCU1IFYcC8sHzCptcOVlOUeKLxkQNy
VZHOq7Ya83GDzP7fogPoQC3xCDCxEEMntOcTvGBUI/VV3XQHcPnOYg==
=hB1M
-----END PGP SIGNATURE-----
--=-=-=--