BaseSocketSendThread.cpp 894 Bytes
#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;
}