Added mutex around gethostbyname