2 #include <bzsnet/BufferedSocket.h>
3 #include <bzscore/sync.h>
4 #include <bzscore/thread.h>
6 namespace GDBServerFoundation
41 BazisLib::Network::TCPSocketEx *m_pSocket;
44 BazisLib::MemberThread m_WorkerThread;
45 BazisLib::Mutex m_RecvMutex;
46 BazisLib::Semaphore m_Semaphore;
52 int WorkerThreadBody()
54 BazisLib::MutexLocker lck(m_RecvMutex);
55 while (!m_bTerminating)
58 void *pData = m_pSocket->PeekAbs(1, &total);
59 if (!pData || !total || *((
char *)pData) ==
kBreakInByte)
62 m_pSocket->Discard(pData, 1);
86 , m_bTerminating(false)
89 m_WorkerThread.Start();
94 m_bTerminating =
true;
96 m_WorkerThread.Join();
99 size_t Send(
const void *pBuffer,
size_t size)
101 return m_pSocket->Send(pBuffer, size);
119 m_Socket.m_RecvMutex.Lock();
124 return m_Socket.m_pSocket;
129 m_Socket.m_RecvMutex.Unlock();
130 m_Socket.m_Semaphore.Signal();