using the CAsyncSocket example from Mr. Newcomer (http://
www.flounder.com/detach.htm#Sockets) as a starting point - I`m facing
maybe one synchronisation problem.
I want to close the socket (class SocketThread :public CWinThread)
during the software is running by clicking on a button (for example).
Is it still enough to write only a PostThreadMessage from the
mainthread to the SocketThread (m_myThread):
::PostThreadMessage(m_myThread->m_nThreadID, UWM_TERM_THREAD, 0, 0);
to kill the socket thread as well as all http connections which were
established at this moment? These http connections threads will be
established in the OnAccept() method of the class CConnSoc :public
For example if one http connection thread needs some values from the
mainthread I `ve installed a PostMessage with a std:map to the
mainthread asking for these values and getting back by another
PostMessage to the http connection thread.
std::map<CString, CString> map = new (std::map<CString, CString>)
wnd->PostMessage(UWM_TO_MAINTHREAD, map, threadID);
// anyhting else
If this http connection thread will be closed or killed by clicking on
the button - I`ll have some memory leaks if the http connection thread
has send a UWM_TO_MAINTHREAD to mainthread but can`t return to this
thread (GetMsgBackFromMainthread) to delete the map...
1) allocating heap space for the map and sending
2) clicking on the button to send PostThreadMessage(m_myThread-
3) http-connection thread will be killed by this PostThreadMessage()
4) but the allocating heap space is still there...
How could I satisfy that all http connection threads will be closed
without having such memory leaks effects?