Check whether getaddrinfo is thread-safe and use locks if not.