[Spice-devel] [RFC v4 51/62] server/red_worker: get_streams_timeout: go over all clients

Alon Levy alevy at redhat.com
Tue Apr 26 03:55:16 PDT 2011


---
 server/red_worker.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/server/red_worker.c b/server/red_worker.c
index fe21a4c..7e022f6 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -2476,7 +2476,7 @@ static void red_streams_update_clip(RedWorker *worker, Surfaces *surfaces, Drawa
     }
 }
 
-static inline unsigned int red_get_streams_timout(Surfaces *surfaces)
+static inline unsigned int __red_get_streams_timout(Surfaces *surfaces)
 {
     unsigned int timout = -1;
     Ring *ring = &surfaces->streams;
@@ -2499,6 +2499,18 @@ static inline unsigned int red_get_streams_timout(Surfaces *surfaces)
     return timout;
 }
 
+static inline unsigned int red_get_streams_timout(RedWorker *worker)
+{
+    Surfaces *surfaces;
+    RingItem *link;
+    unsigned int timeout = ~0;
+
+    SURFACES_FOREACH(link, surfaces, worker) {
+        timeout = MIN(timeout, __red_get_streams_timout(surfaces));
+    }
+    return timeout;
+}
+
 static inline void red_handle_streams_timout(RedWorker *worker, Surfaces *surfaces)
 {
     Ring *ring = &surfaces->streams;
@@ -10772,7 +10784,7 @@ void *red_worker_main(void *arg)
         struct epoll_event *event;
         struct epoll_event *end;
 
-        worker.epoll_timeout = MIN(red_get_streams_timout(&worker.surfaces), worker.epoll_timeout);
+        worker.epoll_timeout = MIN(red_get_streams_timout(&worker), worker.epoll_timeout);
         num_events = epoll_wait(worker.epoll, events, MAX_EPOLL_SOURCES, worker.epoll_timeout);
         red_handle_streams_timout(&worker, &worker.surfaces);
 
-- 
1.7.4.4



More information about the Spice-devel mailing list