void SFMultiLogicDispatcher::MultiLogicProc(void* Args) { #ifdef _WIN32 SFIOCPQueue<BasePacket>* pQueue = static_cast<SFIOCPQueue<BasePacket>*>(Args); #else SFLockQueue<BasePacket>* pQueue = static_cast<SFLockQueue<BasePacket>*>(Args); #endif LogicEntry::GetInstance()->Initialize(); while (true) { BasePacket* pPacket = pQueue->Pop(-1); if (pPacket == nullptr) continue; if (pPacket->GetPacketType() == SFPACKET_SERVERSHUTDOWN) break; else { LogicEntry::GetInstance()->ProcessPacket(pPacket); if (pPacket->GetPacketType() != SFPACKET_DB) { ReleasePacket(pPacket); } } } }
void SFMulitiCasualGameDispatcher::CasualGameLogicProc(void* Args) { CasualGameParam* pParam = static_cast<CasualGameParam*>(Args); SFIOCPQueue<BasePacket>* pQueue = pParam->pQueue; ILogicEntry* pEntry = pParam->pLogicEntry; while (m_bLogicEnd == false) { BasePacket* pPacket = pQueue->Pop(INFINITE); if (pPacket) { pEntry->ProcessPacket(pPacket); if (pPacket->GetPacketType() != SFPACKET_DB) { ReleasePacket(pPacket); } } } }