Some fixes

This commit is contained in:
Nekotekina 2015-07-01 20:09:26 +03:00
parent 3aefa2b4e1
commit 6f1e76198a
98 changed files with 2326 additions and 2348 deletions

View file

@ -12,7 +12,7 @@ void EventManager::Init()
void EventManager::Clear()
{
eq_map.clear();
m_map.clear();
}
bool EventManager::CheckKey(u64 key)
@ -23,29 +23,9 @@ bool EventManager::CheckKey(u64 key)
return false;
}
std::lock_guard<std::mutex> lock(m_lock);
std::lock_guard<std::mutex> lock(m_mutex);
return eq_map.find(key) != eq_map.end();
}
bool EventManager::RegisterKey(const std::shared_ptr<lv2_event_queue_t>& data)
{
if (!data->key)
{
// always ok
return true;
}
std::lock_guard<std::mutex> lock(m_lock);
if (eq_map.find(data->key) != eq_map.end())
{
return false;
}
eq_map[data->key] = data;
return true;
return m_map.find(key) != m_map.end();
}
bool EventManager::UnregisterKey(u64 key)
@ -56,12 +36,12 @@ bool EventManager::UnregisterKey(u64 key)
return true;
}
std::lock_guard<std::mutex> lock(m_lock);
std::lock_guard<std::mutex> lock(m_mutex);
auto f = eq_map.find(key);
if (f != eq_map.end())
auto f = m_map.find(key);
if (f != m_map.end())
{
eq_map.erase(f);
m_map.erase(f);
return true;
}
@ -76,10 +56,10 @@ std::shared_ptr<lv2_event_queue_t> EventManager::GetEventQueue(u64 key)
return nullptr;
}
std::lock_guard<std::mutex> lock(m_lock);
std::lock_guard<std::mutex> lock(m_mutex);
auto f = eq_map.find(key);
if (f != eq_map.end())
auto f = m_map.find(key);
if (f != m_map.end())
{
return f->second;
}