Fix data races in DNSLookup (tsan)

This commit is contained in:
Benjamin Sergeant
2019-04-24 20:50:10 -07:00
parent 26ee46b246
commit a443bbdf80
4 changed files with 19 additions and 7 deletions

View File

@ -39,7 +39,7 @@ namespace ix
struct addrinfo* resolveBlocking(std::string& errMsg,
const CancellationRequest& isCancellationRequested);
static struct addrinfo* getAddrInfo(const std::string& hostname,
static struct addrinfo* getAddrInfo(std::string hostname,
int port,
std::string& errMsg);
@ -50,6 +50,7 @@ namespace ix
int64_t _wait;
std::string _errMsg;
struct addrinfo* _res;
static std::mutex _resMutex;
std::atomic<bool> _done;
std::thread _thread;