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

Unified Diff: runtime/bin/socket_win.cc

Issue 200083002: Use mutex around getaddrinfo on windows, as it's not thread-safe. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 77c51ef92bc6648ce4f53e2e5c077b8465ae28c3..da82b273b68ec6385beeb2252cec366a395d6706 100644
--- a/runtime/bin/socket_win.cc
+++ b/runtime/bin/socket_win.cc
@@ -12,6 +12,8 @@
#include "bin/socket.h"
#include "bin/utils.h"
+#include "vm/thread.h"
+
namespace dart {
namespace bin {
@@ -217,11 +219,15 @@ 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