BaseSocketSendThread.cpp
894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "BaseSocketSendThread.h"
#include <unistd.h>
#include "BaseSocket.h"
CBaseSocketSendThread::CBaseSocketSendThread()
{
m_pSocket = NULL;
}
CBaseSocketSendThread::~CBaseSocketSendThread()
{
}
BOOL CBaseSocketSendThread::InitInstance()
{
// TODO: perform and per-thread initialization here
while (m_pSocket == NULL)
sleep(1);
return CBaseThread::InitInstance();
}
int CBaseSocketSendThread::ExitInstance()
{
// TODO: perform any per-thread cleanup here
return CBaseThread::ExitInstance();
}
int CBaseSocketSendThread::Run()
{
// TODO: Add your specialized code here and/or call the base class
BOOL bExit = FALSE;
while (!bExit)
{
m_pSocket->SendData(10);
if (IsStopping(0))
{
bExit = TRUE;
}
}
return ExitInstance();
}
void CBaseSocketSendThread::SetSocket(CBaseSocket *pSocket)
{
m_pSocket = pSocket;
}