summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source/cSocketThreads.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/cSocketThreads.cpp b/source/cSocketThreads.cpp
index 1aa802a23..fbef2a2c3 100644
--- a/source/cSocketThreads.cpp
+++ b/source/cSocketThreads.cpp
@@ -226,6 +226,15 @@ cSocketThreads::cSocketThread::cSocketThread(cSocketThreads * a_Parent) :
cSocketThreads::cSocketThread::~cSocketThread()
{
m_ShouldTerminate = true;
+
+ // Notify the thread:
+ ASSERT(m_ControlSocket2.IsValid());
+ m_ControlSocket2.Send("a", 1);
+
+ // Wait for the thread to finish:
+ Wait();
+
+ // Close the control sockets:
m_ControlSocket1.CloseSocket();
m_ControlSocket2.CloseSocket();
}