std::shared_ptr in IdManager

This commit is contained in:
Nekotekina 2014-12-24 02:38:13 +03:00
parent b2de24db73
commit d8239a39c9
47 changed files with 654 additions and 622 deletions

View file

@ -23,7 +23,7 @@ bool EventManager::CheckKey(u64 key)
return key_map.find(key) != key_map.end();
}
bool EventManager::RegisterKey(EventQueue* data, u64 key)
bool EventManager::RegisterKey(std::shared_ptr<EventQueue>& data, u64 key)
{
if (!key) return true;
std::lock_guard<std::mutex> lock(m_lock);
@ -40,7 +40,7 @@ bool EventManager::RegisterKey(EventQueue* data, u64 key)
return true;
}
bool EventManager::GetEventQueue(u64 key, EventQueue*& data)
bool EventManager::GetEventQueue(u64 key, std::shared_ptr<EventQueue>& data)
{
data = nullptr;
if (!key) return false;
@ -79,8 +79,7 @@ bool EventManager::SendEvent(u64 key, u64 source, u64 d1, u64 d2, u64 d3)
{
return false;
}
EventQueue* eq = f->second;
eq->events.push(source, d1, d2, d3);
f->second->events.push(source, d1, d2, d3);
return true;
}