Remove unnecessary mutex from C++ socket code
Summary: This is a threadsafe syscall, as it turns out.
Reviewed By: hzhao
Test Plan: Thrift Client C++ sockets don't lock
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665384 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/transport/TSocket.cpp b/lib/cpp/src/transport/TSocket.cpp
index 0114fdc..2171bab 100644
--- a/lib/cpp/src/transport/TSocket.cpp
+++ b/lib/cpp/src/transport/TSocket.cpp
@@ -23,7 +23,6 @@
namespace facebook { namespace thrift { namespace transport {
using namespace std;
-using namespace facebook::thrift::concurrency;
// Global var to track total socket sys calls
uint32_t g_socket_syscalls = 0;
@@ -34,9 +33,6 @@
* @author Mark Slee <mcslee@facebook.com>
*/
-// Mutex to protect syscalls to netdb
-static Monitor s_netdb_monitor;
-
TSocket::TSocket(string host, int port) :
host_(host),
port_(port),
@@ -224,11 +220,8 @@
hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
sprintf(port, "%d", port_);
- {
- // Scope lock on host entry lookup
- Synchronized s(s_netdb_monitor);
- error = getaddrinfo(host_.c_str(), port, &hints, &res0);
- }
+ error = getaddrinfo(host_.c_str(), port, &hints, &res0);
+
if (error) {
fprintf(stderr, "getaddrinfo %d: %s\n", error, gai_strerror(error));
close();