summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2015-08-21 11:15:55 +0100
committerFrediano Ziglio <fziglio@redhat.com>2015-09-03 16:04:27 +0100
commit39be1c448cad0b86204753253dcdd6a03fb9a320 (patch)
treed37479ce4b0c18422a1749d6a7c9abe2f945995d
parent83f507db4bef97507feb92d8edcbbe12881de435 (diff)
avoid to call red_get_streams_timout twice computing timeout
Due to how the MIN macro is defined the function was called twice unless the compiler could demonstrate that was returning the same value (which actually is impossible as function as clock_gettime are not deterministic). Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
-rw-r--r--server/red_worker.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/server/red_worker.c b/server/red_worker.c
index e7ee6b6..2f2d5a9 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -12189,11 +12189,12 @@ SPICE_GNUC_NORETURN void *red_worker_main(void *arg)
for (;;) {
int i, num_events;
- unsigned int timers_queue_timeout;
+ unsigned int timeout;
- timers_queue_timeout = spice_timer_queue_get_timeout_ms();
- worker->event_timeout = MIN(red_get_streams_timout(worker), worker->event_timeout);
- worker->event_timeout = MIN(timers_queue_timeout, worker->event_timeout);
+ timeout = spice_timer_queue_get_timeout_ms();
+ worker->event_timeout = MIN(timeout, worker->event_timeout);
+ timeout = red_get_streams_timout(worker);
+ worker->event_timeout = MIN(timeout, worker->event_timeout);
num_events = poll(worker->poll_fds, MAX_EVENT_SOURCES, worker->event_timeout);
red_handle_streams_timout(worker);
spice_timer_queue_cb();