[Cogl] [PATCH] poll: Always let the winsys add fds even if there is a zero timeout

Neil Roberts neil at linux.intel.com
Sun Feb 3 01:03:39 PST 2013


Even if Cogl decides to set a zero timeout because there are events
queued, it still makes sense to give the winsys a chance to add file
descriptors to the list. The winsys might be relying on the list of
CoglPollFDs passed to poll_dispatch to decide whether to read from a
file descriptor and that should happen even if Cogl also woke up the
main loop because the event queue isn't empty.
---
 cogl/cogl-poll.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/cogl/cogl-poll.c b/cogl/cogl-poll.c
index c6d19fb..277b9a7 100644
--- a/cogl/cogl-poll.c
+++ b/cogl/cogl-poll.c
@@ -44,13 +44,6 @@ cogl_poll_get_info (CoglContext *context,
   _COGL_RETURN_IF_FAIL (n_poll_fds != NULL);
   _COGL_RETURN_IF_FAIL (timeout != NULL);
 
-  if (!COGL_TAILQ_EMPTY (&context->onscreen_events_queue))
-    {
-      *n_poll_fds = 0;
-      *timeout = 0;
-      return;
-    }
-
   winsys = _cogl_context_get_winsys (context);
 
   if (winsys->poll_get_info)
@@ -59,13 +52,17 @@ cogl_poll_get_info (CoglContext *context,
                              poll_fds,
                              n_poll_fds,
                              timeout);
-      return;
+    }
+  else
+    {
+      /* By default we'll assume Cogl doesn't need to block on anything */
+      *poll_fds = NULL;
+      *n_poll_fds = 0;
+      *timeout = -1; /* no timeout */
     }
 
-  /* By default we'll assume Cogl doesn't need to block on anything */
-  *poll_fds = NULL;
-  *n_poll_fds = 0;
-  *timeout = -1; /* no timeout */
+  if (!COGL_TAILQ_EMPTY (&context->onscreen_events_queue))
+    *timeout = 0;
 }
 
 void
-- 
1.7.11.3.g3c3efa5



More information about the Cogl mailing list