res_query (int res_query(const char *dname, int class, int type,unsigned char *answer,
int anslen);
) 是线程安全的吗?
我认为是的,因为它将答案写入用户分配的缓冲区(与使用静态分配缓冲区的gethostbyname相反)。
有人确定吗?
res_query (int res_query(const char *dname, int class, int type,unsigned char *answer,
int anslen);
) 是线程安全的吗?
我认为是的,因为它将答案写入用户分配的缓冲区(与使用静态分配缓冲区的gethostbyname相反)。
有人确定吗?
您是正确的,res_query不是线程安全的。您需要使用res_nquery,该函数首先接受一个'res_state'参数。从我所读到的一切来看,这是在线程安全的情况下执行查询的方法。