chore: remove goto in EventQueue, instead use a private processEvent method
This commit is contained in:
@ -101,10 +101,8 @@ void EventQueue::adoptBuffer(IEventQueueBuffer *buffer)
|
||||
}
|
||||
}
|
||||
|
||||
bool EventQueue::getEvent(Event &event, double timeout)
|
||||
bool EventQueue::processEvent(Event &event, double timeout, Stopwatch &timer)
|
||||
{
|
||||
Stopwatch timer(true);
|
||||
retry:
|
||||
// if no events are waiting then handle timers and then wait
|
||||
while (m_buffer->isEmpty()) {
|
||||
// handle timers first
|
||||
@ -139,7 +137,7 @@ retry:
|
||||
// don't want to fail if client isn't expecting that
|
||||
// so if getEvent() fails with an infinite timeout
|
||||
// then just try getting another event.
|
||||
goto retry;
|
||||
processEvent(event, timeout, timer);
|
||||
}
|
||||
return false;
|
||||
|
||||
@ -158,6 +156,12 @@ retry:
|
||||
}
|
||||
}
|
||||
|
||||
bool EventQueue::getEvent(Event &event, double timeout)
|
||||
{
|
||||
Stopwatch timer(true);
|
||||
return processEvent(event, timeout, timer);
|
||||
}
|
||||
|
||||
bool EventQueue::dispatchEvent(const Event &event)
|
||||
{
|
||||
void *target = event.getTarget();
|
||||
|
||||
@ -58,6 +58,15 @@ private:
|
||||
double getNextTimerTimeout() const;
|
||||
void addEventToBuffer(const Event &event);
|
||||
|
||||
//!
|
||||
//! \brief processEvent Internal event proccessing
|
||||
//! \param event - event to process
|
||||
//! \param timeout - Timeout to stop
|
||||
//! \param timer - StopWatch to use
|
||||
//! \return true if handled
|
||||
//!
|
||||
bool processEvent(Event &event, double timeout, Stopwatch &timer);
|
||||
|
||||
private:
|
||||
class Timer
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user