| Index: runtime/bin/socket_win.cc
|
| diff --git a/runtime/bin/socket_win.cc b/runtime/bin/socket_win.cc
|
| index debff6b3f5f9ad270876c24dd9f7a50f1cd7c89f..7c27fde29cc6d64e71a6f62f6e2f255710db8c98 100644
|
| --- a/runtime/bin/socket_win.cc
|
| +++ b/runtime/bin/socket_win.cc
|
| @@ -46,8 +46,11 @@ bool Socket::FormatNumericAddress(RawAddr* addr, char* address, int len) {
|
| }
|
|
|
|
|
| +static Mutex* init_mutex = new Mutex();
|
| +static bool socket_initialized = false;
|
| +
|
| bool Socket::Initialize() {
|
| - static bool socket_initialized = false;
|
| + MutexLocker lock(init_mutex);
|
| if (socket_initialized) return true;
|
| int err;
|
| WSADATA winsock_data;
|
| @@ -219,15 +222,11 @@ intptr_t ServerSocket::Accept(intptr_t fd) {
|
| }
|
|
|
|
|
| -static Mutex* getaddrinfo_mutex = new Mutex();
|
| AddressList<SocketAddress>* Socket::LookupAddress(const char* host,
|
| int type,
|
| OSError** os_error) {
|
| Initialize();
|
|
|
| - // getaddrinfo is not thread-safe on Windows. Use a mutex to get around it.
|
| - MutexLocker locker(getaddrinfo_mutex);
|
| -
|
| // Perform a name lookup for a host name.
|
| struct addrinfo hints;
|
| memset(&hints, 0, sizeof(hints));
|
|
|