[Spice-devel] [PATCH] red_worker: rename epoll_timeout to event_timeout

Dan McGee dpmcgee at gmail.com
Mon Feb 20 16:11:48 PST 2012


With future patches in mind that will allow for some other
non-Linux-specific event polling sytem to be used, rename this to a more
generic name. All of the select/poll/epoll/kqueue family of calls are
related to evented I/O, so 'event_' makes sense in this case.

Signed-off-by: Dan McGee <dpmcgee at gmail.com>
---
 server/red_worker.c |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/server/red_worker.c b/server/red_worker.c
index 4c73952..c912f59 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -232,7 +232,7 @@ double inline stat_byte_to_mega(uint64_t size)
 #endif
 
 #define MAX_EPOLL_SOURCES 10
-#define INF_EPOLL_WAIT ~0
+#define INF_EVENT_WAIT ~0
 
 
 typedef struct EventListener EventListener;
@@ -878,7 +878,7 @@ typedef struct RedWorker {
     int running;
     uint32_t *pending;
     int epoll;
-    unsigned int epoll_timeout;
+    unsigned int event_timeout;
     uint32_t repoll_cmd_ring;
     uint32_t repoll_cursor_ring;
     uint32_t num_renderers;
@@ -4658,7 +4658,7 @@ static int red_process_cursor(RedWorker *worker, uint32_t max_pipe_size, int *ri
             *ring_is_empty = TRUE;
             if (worker->repoll_cursor_ring < CMD_RING_POLL_RETRIES) {
                 worker->repoll_cursor_ring++;
-                worker->epoll_timeout = MIN(worker->epoll_timeout, CMD_RING_POLL_TIMEOUT);
+                worker->event_timeout = MIN(worker->event_timeout, CMD_RING_POLL_TIMEOUT);
                 break;
             }
             if (worker->repoll_cursor_ring > CMD_RING_POLL_RETRIES ||
@@ -4713,7 +4713,7 @@ static int red_process_commands(RedWorker *worker, uint32_t max_pipe_size, int *
             *ring_is_empty = TRUE;;
             if (worker->repoll_cmd_ring < CMD_RING_POLL_RETRIES) {
                 worker->repoll_cmd_ring++;
-                worker->epoll_timeout = MIN(worker->epoll_timeout, CMD_RING_POLL_TIMEOUT);
+                worker->event_timeout = MIN(worker->event_timeout, CMD_RING_POLL_TIMEOUT);
                 break;
             }
             if (worker->repoll_cmd_ring > CMD_RING_POLL_RETRIES ||
@@ -4782,7 +4782,7 @@ static int red_process_commands(RedWorker *worker, uint32_t max_pipe_size, int *
         if ((worker->display_channel &&
              red_channel_all_blocked(&worker->display_channel->common.base))
             || red_now() - start > 10 * 1000 * 1000) {
-            worker->epoll_timeout = 0;
+            worker->event_timeout = 0;
             return n;
         }
     }
@@ -7875,10 +7875,10 @@ static inline void display_channel_send_free_list(RedChannelClient *rcc)
     urgent_marshaller = red_channel_client_switch_to_urgent_sender(rcc);
     for (i = 0; i < dcc->send_data.num_pixmap_cache_items; i++) {
         int dummy;
-        /* When using the urgent marshaller, the serial number of the message that is
-         * going to be sent right after the SPICE_MSG_LIST, is increased by one.
-         * But all this message pixmaps cache references used its old serial.
-         * we use pixmap_cache_items to collect these pixmaps, and we update their serial by calling pixmap_cache_hit.*/
+        /* When using the urgent marshaller, the serial number of the message that is going to be
+         * sent right after the SPICE_MSG_LIST, is increased by one.  But all this message pixmaps
+         * cache references used its old serial.  we use pixmap_cache_items to collect these
+         * pixmaps, and we update their serial by calling pixmap_cache_hit. */
         pixmap_cache_hit(dcc->pixmap_cache, dcc->send_data.pixmap_cache_items[i],
                          &dummy, dcc);
     }
@@ -11153,15 +11153,15 @@ void *red_worker_main(void *arg)
     red_init_lz(&worker);
     red_init_jpeg(&worker);
     red_init_zlib(&worker);
-    worker.epoll_timeout = INF_EPOLL_WAIT;
+    worker.event_timeout = INF_EVENT_WAIT;
     for (;;) {
         struct epoll_event events[MAX_EPOLL_SOURCES];
         int num_events;
         struct epoll_event *event;
         struct epoll_event *end;
 
-        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);
+        worker.event_timeout = MIN(red_get_streams_timout(&worker), worker.event_timeout);
+        num_events = epoll_wait(worker.epoll, events, MAX_EPOLL_SOURCES, worker.event_timeout);
         red_handle_streams_timout(&worker);
 
         if (worker.display_channel) {
@@ -11172,7 +11172,7 @@ void *red_worker_main(void *arg)
                 red_display_cc_free_glz_drawables);
         }
 
-        worker.epoll_timeout = INF_EPOLL_WAIT;
+        worker.event_timeout = INF_EVENT_WAIT;
         if (num_events == -1) {
             if (errno != EINTR) {
                 red_error("poll_wait failed, %s", strerror(errno));
-- 
1.7.9.1



More information about the Spice-devel mailing list