예제 #1
0
void Craze::EventManager::Update()
{
	PROFILE("EventManager::Update");

	m_CurrentQue++;

	if (m_CurrentQue == 2)
	{
		m_CurrentQue = 0;
	}

	EventList* pProcQue = GetLastQue();

	while(!pProcQue->empty())
	{
		EventItem itm = pProcQue->front();

		EventListenerMap::iterator typeIt = m_Listeners.find(itm.pEvent->VGetType());

		if (typeIt != m_Listeners.end())
		{
			for (EventListenerList::iterator i = typeIt->second.begin(); i != typeIt->second.end(); ++i)
			{
				(*i).second(itm.pEvent);

			}
		}
	

		if (itm.autoDelete)
		{
			delete itm.pEvent;
			itm.pEvent = 0;
		}

		pProcQue->pop_front();
	}
}
ThreadPoolTaskExecutor::EventList ThreadPoolTaskExecutor::makeSingletonEventList() {
    EventList result;
    result.emplace_front(EventState::make());
    result.front()->iter = result.begin();
    return result;
}