summaryrefslogtreecommitdiff
path: root/Bus/Ivy
diff options
context:
space:
mode:
authorfcolin2007-02-01 13:05:22 +0000
committerfcolin2007-02-01 13:05:22 +0000
commitf1bce63c55af4208ccabbecfc1fbd0df110f8af3 (patch)
tree7b546ca218df1ceddda7974085252d046012ab51 /Bus/Ivy
parent4dc018c4099fb393f7619c8f7c5743bc4633cbc0 (diff)
downloadivy-cplusplus-f1bce63c55af4208ccabbecfc1fbd0df110f8af3.zip
ivy-cplusplus-f1bce63c55af4208ccabbecfc1fbd0df110f8af3.tar.gz
ivy-cplusplus-f1bce63c55af4208ccabbecfc1fbd0df110f8af3.tar.bz2
ivy-cplusplus-f1bce63c55af4208ccabbecfc1fbd0df110f8af3.tar.xz
Utilisateur : Fcolin Date : 25/11/02 Heure : 16:15 Archivé dans $/Bus/Ivy Commentaire: (vss 18)
Diffstat (limited to 'Bus/Ivy')
-rw-r--r--Bus/Ivy/ThreadedSocket.cxx27
1 files changed, 13 insertions, 14 deletions
diff --git a/Bus/Ivy/ThreadedSocket.cxx b/Bus/Ivy/ThreadedSocket.cxx
index 31bcf18..42a8216 100644
--- a/Bus/Ivy/ThreadedSocket.cxx
+++ b/Bus/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)