summaryrefslogtreecommitdiffstats
path: root/client/process_loop.cpp
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2009-11-09 17:20:30 +0200
committerYaniv Kamay <ykamay@redhat.com>2009-11-09 17:38:27 +0200
commit278c40f301b7adddc6a40c0b9061356b49909ed8 (patch)
tree00633740b5eaa152bfaaa419c18d86fa594627c1 /client/process_loop.cpp
parent49f5e5973c5be6ba23f1dbe9c4ef5ab08017e962 (diff)
downloadspice-278c40f301b7adddc6a40c0b9061356b49909ed8.tar.gz
spice-278c40f301b7adddc6a40c0b9061356b49909ed8.tar.xz
spice-278c40f301b7adddc6a40c0b9061356b49909ed8.zip
spice client: cosmetic changes
Diffstat (limited to 'client/process_loop.cpp')
-rw-r--r--client/process_loop.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/client/process_loop.cpp b/client/process_loop.cpp
index 41aac43e..66f676f3 100644
--- a/client/process_loop.cpp
+++ b/client/process_loop.cpp
@@ -97,7 +97,7 @@ int EventsQueue::push_event(Event* event)
{
Lock lock(_events_lock);
_events.push_back(event);
- event->_generation = _events_gen;
+ event->set_generation(_events_gen);
event->ref();
#ifdef RED_DEBUG
event->set_process_loop(&_owner);
@@ -116,7 +116,7 @@ void EventsQueue::process_events()
return;
}
event = _events.front();
- if (event->_generation == _events_gen) {
+ if (event->get_generation() == _events_gen) {
return;
}
_events.pop_front();
@@ -160,6 +160,22 @@ void Timer::disarm()
_is_armed = false;
}
+#define TIMER_COMPENSATION
+
+void Timer::calc_next_expiration_time(uint64_t now)
+{
+#ifndef TIMER_COMPENSATION
+ _expiratoin = now;
+#endif
+ calc_next_expiration_time();
+#ifdef TIMER_COMPENSATION
+ if (_expiration <= now) {
+ _expiration = now;
+ calc_next_expiration_time();
+ }
+#endif
+}
+
uint64_t Timer::get_now()
{
return (Platform::get_monolithic_time() / 1000 / 1000);
@@ -226,7 +242,6 @@ int TimersQueue::get_soonest_timeout()
return (int)(next_time - now);
}
-#define TIMER_COMPENSATION
void TimersQueue::timers_action()
{
@@ -238,16 +253,7 @@ void TimersQueue::timers_action()
((*iter)->get_expiration() <= now)) {
Timer* timer = *iter;
_armed_timers.erase(iter);
-#ifndef TIMER_COMPENSATION
- timer->_experatoin = now;
-#endif
- timer->calc_next_expiration_time();
-#ifdef TIMER_COMPENSATION
- if (timer->_expiration <= now) {
- timer->_expiration = now;
- timer->calc_next_expiration_time();
- }
-#endif
+ timer->calc_next_expiration_time(now);
_armed_timers.insert(timer);
timer->response(_owner);
}