summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy White <jwhite@codeweavers.com>2012-06-03 10:28:05 -0500
committerAlon Levy <alevy@redhat.com>2012-06-17 12:09:20 +0300
commit6832c0fd917556c52f56f8e82706a83942ed3dc1 (patch)
treec48f77e1137b452462fdb8b4ae4f1c03a3bf406f
parent72a0def8114073c0051f3df880f731d3968cb344 (diff)
Actually process write watches in the wakeup handler
My apologies for the churn; this is, I think, a slightly better patch than my previous patch, 'Process watches even when there is no X activity', in that it avoids doing an extra polling select when we're idle.
-rw-r--r--src/spiceqxl_main_loop.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/spiceqxl_main_loop.c b/src/spiceqxl_main_loop.c
index 1718861..e57fb91 100644
--- a/src/spiceqxl_main_loop.c
+++ b/src/spiceqxl_main_loop.c
@@ -315,9 +315,24 @@ static void select_and_check_watches(void)
}
}
+static int no_write_watches(Ring *w)
+{
+ SpiceWatch *watch;
+ RingItem *link;
+ RingItem *next;
+
+ RING_FOREACH_SAFE(link, next, w) {
+ watch = (SpiceWatch*)link;
+ if (!watch->remove && (watch->event_mask & SPICE_WATCH_EVENT_WRITE))
+ return 0;
+ }
+
+ return 1;
+}
+
static void xspice_wakeup_handler(pointer data, int nfds, pointer readmask)
{
- if (!nfds) {
+ if (!nfds && no_write_watches(&watches)) {
return;
}
select_and_check_watches();