Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
48 lines
748 B
C++
48 lines
748 B
C++
#include "stdafx.h"
|
|
#include "CompletionHandler.h"
|
|
|
|
CCompletionHandler::CCompletionHandler()
|
|
: m_hIOCP(INVALID_HANDLE_VALUE), m_nThread(0), m_nTimeOutMS(0)
|
|
{
|
|
|
|
}
|
|
|
|
|
|
CCompletionHandler::~CCompletionHandler()
|
|
{
|
|
Destroy();
|
|
}
|
|
|
|
|
|
bool CCompletionHandler::Initialize(unsigned long nThread, unsigned long nTimeOutMS)
|
|
{
|
|
if(INVALID_HANDLE_VALUE != m_hIOCP)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
m_hIOCP = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, NULL, nThread);
|
|
if(0 == m_hIOCP)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
m_nThread = nThread;
|
|
m_nTimeOutMS = nTimeOutMS;
|
|
return true;
|
|
}
|
|
|
|
|
|
bool CCompletionHandler::Destroy()
|
|
{
|
|
if(INVALID_HANDLE_VALUE != m_hIOCP)
|
|
{
|
|
if(!CloseHandle(m_hIOCP))
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
m_hIOCP = INVALID_HANDLE_VALUE;
|
|
return true;
|
|
} |