[Spice-devel] [RFCv5 35/47] server/red_worker: get_streams_timeout: go over all clients

Alon Levy alevy at redhat.com
Sun May 8 06:11:31 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 25738a3..77b731a 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -2499,7 +2499,7 @@ static void red_streams_update_clip(RedRender *render, Drawable *drawable)
     }
 }
 
-static inline unsigned int red_get_streams_timout(RedRender *render)
+static inline unsigned int red_render_get_streams_timout(RedRender *render)
 {
     unsigned int timout = -1;
     Ring *ring = &render->streams;
@@ -2522,6 +2522,18 @@ static inline unsigned int red_get_streams_timout(RedRender *render)
     return timout;
 }
 
+static inline unsigned int red_get_streams_timout(RedWorker *worker)
+{
+    RedRender *render;
+    RingItem *link;
+    unsigned int timeout = ~0;
+
+    RENDER_FOREACH(link, render, worker) {
+        timeout = MIN(timeout, red_render_get_streams_timout(render));
+    }
+    return timeout;
+}
+
 static inline void red_handle_streams_timout(RedRender *render)
 {
     Ring *ring = &render->streams;
@@ -10794,7 +10806,7 @@ void *red_worker_main(void *arg)
         struct epoll_event *event;
         struct epoll_event *end;
 
-        worker.epoll_timeout = MIN(red_get_streams_timout(&worker.render), 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);
         RENDER_FOREACH(link, render, &worker) {
             red_handle_streams_timout(render);
-- 
1.7.5.1



More information about the Spice-devel mailing list