Commit 8babe50f by Carwyn

Fixes: 1.去除 GetThreadId 调用

parent 298b1ad8
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
FMSockServer::FMSockServer(FMApiRelay *relay) : FMSockServer::FMSockServer(FMApiRelay *relay) :
_worker(0), _worker(0),
_worker_tid(0),
_port(0), _port(0),
_relay(relay) _relay(relay)
{ {
...@@ -44,9 +45,8 @@ FMSockServer::~FMSockServer() ...@@ -44,9 +45,8 @@ FMSockServer::~FMSockServer()
VOID FMSockServer::Listen(USHORT port) VOID FMSockServer::Listen(USHORT port)
{ {
_port = port; _port = port;
DWORD tid = 0; _worker = CreateThread(NULL, 0, FMSockServer::RecvWorker, this, 0, &_worker_tid);
_worker = CreateThread(NULL, 0, FMSockServer::RecvWorker, this, 0, &tid); FMLOG(_T("Server thread %ld started."), _worker_tid);
FMLOG(_T("Server thread %ld started."), tid);
} }
...@@ -57,7 +57,7 @@ BOOL FMSockServer::Stop() ...@@ -57,7 +57,7 @@ BOOL FMSockServer::Stop()
WaitForSingleObject(_worker, INFINITE); WaitForSingleObject(_worker, INFINITE);
CloseHandle(_worker); CloseHandle(_worker);
FMLOG(_T("Server thread %ld stopped. exit."), GetThreadId(_worker)); FMLOG(_T("Server thread %ld stopped. exit."), _worker_tid);
return TRUE; return TRUE;
} }
......
...@@ -72,6 +72,7 @@ private: ...@@ -72,6 +72,7 @@ private:
USHORT _port; USHORT _port;
sockaddr_in _addr_in; sockaddr_in _addr_in;
HANDLE _worker; HANDLE _worker;
DWORD _worker_tid;
FMApiRelay *_relay; FMApiRelay *_relay;
CRITICAL_SECTION _cs; CRITICAL_SECTION _cs;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment