diff options
-rw-r--r-- | lldb/include/lldb/Core/ConnectionFileDescriptor.h | 2 | ||||
-rw-r--r-- | lldb/source/Core/ConnectionFileDescriptor.cpp | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lldb/include/lldb/Core/ConnectionFileDescriptor.h b/lldb/include/lldb/Core/ConnectionFileDescriptor.h index 44c98eb11da..b2a29d6c6e2 100644 --- a/lldb/include/lldb/Core/ConnectionFileDescriptor.h +++ b/lldb/include/lldb/Core/ConnectionFileDescriptor.h @@ -19,6 +19,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Core/Connection.h" +#include "lldb/Host/Mutex.h" #include "lldb/Host/SocketAddress.h" namespace lldb_private { @@ -104,6 +105,7 @@ protected: SocketAddress m_udp_send_sockaddr; bool m_should_close_fd; // True if this class should close the file descriptor when it goes away. uint32_t m_socket_timeout_usec; + Mutex m_mutex; static in_port_t GetSocketPort (int fd); diff --git a/lldb/source/Core/ConnectionFileDescriptor.cpp b/lldb/source/Core/ConnectionFileDescriptor.cpp index 6069f8beec5..b349a410b3e 100644 --- a/lldb/source/Core/ConnectionFileDescriptor.cpp +++ b/lldb/source/Core/ConnectionFileDescriptor.cpp @@ -73,7 +73,8 @@ ConnectionFileDescriptor::ConnectionFileDescriptor () : m_fd_recv_type (eFDTypeFile), m_udp_send_sockaddr (), m_should_close_fd (false), - m_socket_timeout_usec(0) + m_socket_timeout_usec(0), + m_mutex (Mutex::eMutexTypeRecursive) { LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION | LIBLLDB_LOG_OBJECT)); if (log) @@ -113,6 +114,7 @@ ConnectionFileDescriptor::IsConnected () const ConnectionStatus ConnectionFileDescriptor::Connect (const char *s, Error *error_ptr) { + Mutex::Locker locker (m_mutex); LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION)); if (log) log->Printf ("%p ConnectionFileDescriptor::Connect (url = '%s')", this, s); @@ -232,6 +234,7 @@ ConnectionFileDescriptor::Connect (const char *s, Error *error_ptr) ConnectionStatus ConnectionFileDescriptor::Disconnect (Error *error_ptr) { + Mutex::Locker locker (m_mutex); LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION)); if (log) log->Printf ("%p ConnectionFileDescriptor::Disconnect ()", this); @@ -599,6 +602,7 @@ ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_pt ConnectionStatus ConnectionFileDescriptor::Close (int& fd, Error *error_ptr) { + Mutex::Locker locker (m_mutex); if (error_ptr) error_ptr->Clear(); bool success = true; |