diff options
author | fcolin | 2007-02-01 13:05:22 +0000 |
---|---|---|
committer | fcolin | 2007-02-01 13:05:22 +0000 |
commit | e8934aef52d003b97a36a651ced63b7587d85eec (patch) | |
tree | 7d2f612bb069bfc99ea5e790d8914ea6ef0724e0 /Ivy | |
parent | 5d97d1f9916d4c8a7880b965200b0d95510e6dfc (diff) | |
download | ivy-cplusplus-e8934aef52d003b97a36a651ced63b7587d85eec.zip ivy-cplusplus-e8934aef52d003b97a36a651ced63b7587d85eec.tar.gz ivy-cplusplus-e8934aef52d003b97a36a651ced63b7587d85eec.tar.bz2 ivy-cplusplus-e8934aef52d003b97a36a651ced63b7587d85eec.tar.xz |
Utilisateur : Fcolin Date : 25/11/02 Heure : 16:15 Archivé dans $/Bus/Ivy Commentaire: (vss 18)
Diffstat (limited to 'Ivy')
-rw-r--r-- | Ivy/ThreadedSocket.cxx | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/Ivy/ThreadedSocket.cxx b/Ivy/ThreadedSocket.cxx index 31bcf18..42a8216 100644 --- a/Ivy/ThreadedSocket.cxx +++ b/Ivy/ThreadedSocket.cxx @@ -26,21 +26,8 @@ CThreadedSocket::CThreadedSocket() CThreadedSocket::~CThreadedSocket()
{
- long PreviousCount = 0;
- int err;
if (m_hSocket != INVALID_SOCKET)
Close();
- //if ( thread ) // On fait de l'auto delete mais dans le cas de terminaison anormale l'object reste ????!!!
- // delete thread;
-// TRACE("CThreadedSocket waiting for thread end ...\n");
- if ( h_reader ) WaitForSingleObject( h_reader, INFINITE );
- // wake up writer
- if ( h_writer )
- {
- err = ReleaseSemaphore(send_count, 1, &PreviousCount);
- WaitForSingleObject( h_writer, INFINITE );
- }
-// TRACE("CThreadedSocket all thread ended\n");
}
int CThreadedSocket::Create(UINT nSocketPort, int nSocketType, const char * lpszSocketAddress)
{
@@ -136,12 +123,24 @@ int CThreadedSocket::Bind(UINT nSocketPort, const char * lpszSocketAddress) void CThreadedSocket::Close()
{
+ long PreviousCount = 0;
+ int err;
if (m_hSocket != INVALID_SOCKET)
{
//ASSERT(SOCKET_ERROR != closesocket(m_hSocket));
closesocket(m_hSocket); // close silently
m_hSocket = INVALID_SOCKET;
-
+ //if ( thread ) // On fait de l'auto delete mais dans le cas de terminaison anormale l'object reste ????!!!
+ // delete thread;
+// TRACE("CThreadedSocket waiting for thread end ...\n");
+ if ( h_reader ) WaitForSingleObject( h_reader, INFINITE );
+ // wake up writer
+ if ( h_writer )
+ {
+ err = ReleaseSemaphore(send_count, 1, &PreviousCount);
+ WaitForSingleObject( h_writer, INFINITE );
+ }
+// TRACE("CThreadedSocket all thread ended\n");
}
}
int CThreadedSocket::Listen(int nConnectionBacklog)
|