lib/base: Rename m_mutex to mutex_ in EventQueue

This commit is contained in:
Povilas Kanapickas 2021-11-03 02:58:26 +02:00
parent 62913ab748
commit c16581b399
2 changed files with 12 additions and 12 deletions

View File

@ -134,7 +134,7 @@ EventQueue::loop()
Event::Type Event::Type
EventQueue::registerTypeOnce(Event::Type& type, const char* name) EventQueue::registerTypeOnce(Event::Type& type, const char* name)
{ {
std::lock_guard<std::mutex> lock(m_mutex); std::lock_guard<std::mutex> lock(mutex_);
if (type == Event::kUnknown) { if (type == Event::kUnknown) {
m_typeMap.insert(std::make_pair(m_nextType, name)); m_typeMap.insert(std::make_pair(m_nextType, name));
m_nameMap.insert(std::make_pair(name, m_nextType)); m_nameMap.insert(std::make_pair(name, m_nextType));
@ -174,7 +174,7 @@ EventQueue::getTypeName(Event::Type type)
void void
EventQueue::adoptBuffer(IEventQueueBuffer* buffer) EventQueue::adoptBuffer(IEventQueueBuffer* buffer)
{ {
std::lock_guard<std::mutex> lock(m_mutex); std::lock_guard<std::mutex> lock(mutex_);
LOG((CLOG_DEBUG "adopting new buffer")); LOG((CLOG_DEBUG "adopting new buffer"));
@ -259,7 +259,7 @@ retry:
case IEventQueueBuffer::kUser: case IEventQueueBuffer::kUser:
{ {
std::lock_guard<std::mutex> lock(m_mutex); std::lock_guard<std::mutex> lock(mutex_);
event = removeEvent(dataID); event = removeEvent(dataID);
return true; return true;
} }
@ -314,7 +314,7 @@ EventQueue::addEvent(const Event& event)
void void
EventQueue::addEventToBuffer(const Event& event) EventQueue::addEventToBuffer(const Event& event)
{ {
std::lock_guard<std::mutex> lock(m_mutex); std::lock_guard<std::mutex> lock(mutex_);
// store the event's data locally // store the event's data locally
UInt32 eventID = saveEvent(event); UInt32 eventID = saveEvent(event);
@ -336,7 +336,7 @@ EventQueue::newTimer(double duration, void* target)
if (target == NULL) { if (target == NULL) {
target = timer; target = timer;
} }
std::lock_guard<std::mutex> lock(m_mutex); std::lock_guard<std::mutex> lock(mutex_);
m_timers.insert(timer); m_timers.insert(timer);
// initial duration is requested duration plus whatever's on // initial duration is requested duration plus whatever's on
// the clock currently because the latter will be subtracted // the clock currently because the latter will be subtracted
@ -355,7 +355,7 @@ EventQueue::newOneShotTimer(double duration, void* target)
if (target == NULL) { if (target == NULL) {
target = timer; target = timer;
} }
std::lock_guard<std::mutex> lock(m_mutex); std::lock_guard<std::mutex> lock(mutex_);
m_timers.insert(timer); m_timers.insert(timer);
// initial duration is requested duration plus whatever's on // initial duration is requested duration plus whatever's on
// the clock currently because the latter will be subtracted // the clock currently because the latter will be subtracted
@ -368,7 +368,7 @@ EventQueue::newOneShotTimer(double duration, void* target)
void void
EventQueue::deleteTimer(EventQueueTimer* timer) EventQueue::deleteTimer(EventQueueTimer* timer)
{ {
std::lock_guard<std::mutex> lock(m_mutex); std::lock_guard<std::mutex> lock(mutex_);
for (TimerQueue::iterator index = m_timerQueue.begin(); for (TimerQueue::iterator index = m_timerQueue.begin();
index != m_timerQueue.end(); ++index) { index != m_timerQueue.end(); ++index) {
if (index->getTimer() == timer) { if (index->getTimer() == timer) {
@ -386,7 +386,7 @@ EventQueue::deleteTimer(EventQueueTimer* timer)
void void
EventQueue::adoptHandler(Event::Type type, void* target, IEventJob* handler) EventQueue::adoptHandler(Event::Type type, void* target, IEventJob* handler)
{ {
std::lock_guard<std::mutex> lock(m_mutex); std::lock_guard<std::mutex> lock(mutex_);
IEventJob*& job = m_handlers[target][type]; IEventJob*& job = m_handlers[target][type];
delete job; delete job;
job = handler; job = handler;
@ -397,7 +397,7 @@ EventQueue::removeHandler(Event::Type type, void* target)
{ {
IEventJob* handler = NULL; IEventJob* handler = NULL;
{ {
std::lock_guard<std::mutex> lock(m_mutex); std::lock_guard<std::mutex> lock(mutex_);
HandlerTable::iterator index = m_handlers.find(target); HandlerTable::iterator index = m_handlers.find(target);
if (index != m_handlers.end()) { if (index != m_handlers.end()) {
TypeHandlerTable& typeHandlers = index->second; TypeHandlerTable& typeHandlers = index->second;
@ -416,7 +416,7 @@ EventQueue::removeHandlers(void* target)
{ {
std::vector<IEventJob*> handlers; std::vector<IEventJob*> handlers;
{ {
std::lock_guard<std::mutex> lock(m_mutex); std::lock_guard<std::mutex> lock(mutex_);
HandlerTable::iterator index = m_handlers.find(target); HandlerTable::iterator index = m_handlers.find(target);
if (index != m_handlers.end()) { if (index != m_handlers.end()) {
// copy to handlers array and clear table for target // copy to handlers array and clear table for target
@ -439,7 +439,7 @@ EventQueue::removeHandlers(void* target)
IEventJob* IEventJob*
EventQueue::getHandler(Event::Type type, void* target) const EventQueue::getHandler(Event::Type type, void* target) const
{ {
std::lock_guard<std::mutex> lock(m_mutex); std::lock_guard<std::mutex> lock(mutex_);
HandlerTable::const_iterator index = m_handlers.find(target); HandlerTable::const_iterator index = m_handlers.find(target);
if (index != m_handlers.end()) { if (index != m_handlers.end()) {
const TypeHandlerTable& typeHandlers = index->second; const TypeHandlerTable& typeHandlers = index->second;

View File

@ -111,7 +111,7 @@ private:
typedef std::map<void*, TypeHandlerTable> HandlerTable; typedef std::map<void*, TypeHandlerTable> HandlerTable;
int m_systemTarget; int m_systemTarget;
mutable std::mutex m_mutex; mutable std::mutex mutex_;
// registered events // registered events
Event::Type m_nextType; Event::Type m_nextType;