开发者

Is res_query thread-safe?

Is res_query (int res_query(const char *dname, int class, int type,unsigned c开发者_运维技巧har *answer, int anslen);) thread-safe?

I think so, because it writes its answer to an user-allocated buffer (in contrast to gethostbyname that uses a statically allocated buffer).

Does somebody know for sure?


You were right that res_query is not threadsafe. You have to use res_nquery, which takes a 'res_state' argument first. From everything I've read, that is how the query should be done in a thread safe manner.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜