Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Unified Diff: runtime/bin/socket_win.cc

Issue 269623004: Remove the getaddrinfo mutex, but put mutex around winsock initialization. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698