diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2015-05-11 13:59:45 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2015-05-11 13:59:45 +0000 |
commit | 4b5ab9bfb55610ea09b3406ab0b23dd29e66a5f0 (patch) | |
tree | ed66260e5b4224d7d255d12fd9e1a4c81890b2e9 | |
parent | 2240a6333bb7c6b7f852636ba2dbff70235ae0fe (diff) |
minus lock
git-svn-id: http://svn.miranda-ng.org/main/trunk@13529 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/EmLanProto/src/lan.cpp | 9 | ||||
-rw-r--r-- | protocols/EmLanProto/src/lan.h | 4 |
2 files changed, 4 insertions, 9 deletions
diff --git a/protocols/EmLanProto/src/lan.cpp b/protocols/EmLanProto/src/lan.cpp index 739005574d..38dfb2a7fc 100644 --- a/protocols/EmLanProto/src/lan.cpp +++ b/protocols/EmLanProto/src/lan.cpp @@ -78,7 +78,6 @@ void CLan::StopListen() }
if (m_hAcceptTCPThread)
{
- mir_cslock lck(m_csAcceptTCPThread);
TerminateThread(m_hAcceptTCPThread, 0);
m_hAcceptTCPThread = NULL;
}
@@ -231,28 +230,26 @@ void CLan::AcceptTCP() sockaddr_in addrFrom;
int addrLen = sizeof(addrFrom);
in_socket = accept(m_filesoc, (sockaddr*)&addrFrom, &addrLen);
- mir_cslock lck(m_csAcceptTCPThread);
if (in_socket != INVALID_SOCKET)
{
TTCPConnect* tcp_conn = new TTCPConnect;
tcp_conn->m_addr = addrFrom.sin_addr.S_un.S_addr;
tcp_conn->m_lan = this;
tcp_conn->m_socket = in_socket;
- DWORD threadId;
- CreateThread(NULL, 0, OnInTCPConnectionProc, (LPVOID)tcp_conn, 0, &threadId);
+ mir_forkthread(OnInTCPConnectionProc, (void*)tcp_conn);
}
Sleep(100);
}
}
-DWORD WINAPI CLan::OnInTCPConnectionProc(LPVOID lpParameter)
+void __cdecl CLan::OnInTCPConnectionProc(void *lpParameter)
{
TTCPConnect* tcp_conn = (TTCPConnect*)lpParameter;
tcp_conn->m_lan->OnInTCPConnection(tcp_conn->m_addr, tcp_conn->m_socket);
shutdown(tcp_conn->m_socket, SD_BOTH);
closesocket(tcp_conn->m_socket);
delete tcp_conn;
- return 0;
+ return;
}
SOCKET CLan::CreateTCPConnection(u_long addr, LPVOID lpParameter)
diff --git a/protocols/EmLanProto/src/lan.h b/protocols/EmLanProto/src/lan.h index f84494cf05..6df1a07156 100644 --- a/protocols/EmLanProto/src/lan.h +++ b/protocols/EmLanProto/src/lan.h @@ -98,11 +98,9 @@ private: void AcceptTCP();
//! Accept TCP thread handle
HANDLE m_hAcceptTCPThread;
- //! Semaphore for killing accept thread
- mir_cs m_csAcceptTCPThread;
//! Called when new income TCP connection is created
- static DWORD WINAPI OnInTCPConnectionProc(LPVOID lpParameter);
+ static void __cdecl OnInTCPConnectionProc(void *lpParameter);
//! Called when new ougoing TCP connectio is created
static DWORD WINAPI OnOutTCPConnectionProc(LPVOID lpParameter);
|