[PATCH 2/2] xfree86: Remove the teeth from SIGIO input processing

Adam Jackson ajax at redhat.com
Mon Dec 13 09:52:54 PST 2010


Instead of actually processing input in the handler, raise just enough
of a dispatch exception to bomb out of request processing and handle input
instead.  This gets us back to exactly two input processing methods:

- input thread
- main loop dispatch

where the SIGIO handler is merely an optimization for the second case.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 hw/xfree86/common/xf86Events.c |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 5166adc..c42b5ce 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -302,29 +302,37 @@ xf86SigioReadInput(int fd, void *closure)
 }
 
 /*
- * xf86AddEnabledDevice --
- *
+ * The host OS may or may not have working SIGIO handlers.  If they don't,
+ * then the time_to_yield callback never gets called, and input will simply
+ * run out of the main loop whenever it gets around to it.
  */
+
+static void
+time_to_yield(int fd, void *closure)
+{
+    isItTimeToYield = 1;
+}
+
 void
 xf86AddEnabledDevice(InputInfoPtr pInfo)
 {
-    if (!xf86silkenMouseDisableFlag)
+    if (!xf86silkenMouseDisableFlag) {
 	InputThreadRegisterDev(pInfo->fd, (void*) pInfo->read_input, pInfo);
-    else
+    } else {
+	xf86InstallSIGIOHandler(pInfo->fd, time_to_yield, NULL);
 	AddEnabledDevice(pInfo->fd);
+    }
 }
 
-/*
- * xf86RemoveEnabledDevice --
- *
- */
 void
 xf86RemoveEnabledDevice(InputInfoPtr pInfo)
 {
-    if (!xf86silkenMouseDisableFlag)
+    if (!xf86silkenMouseDisableFlag) {
 	InputThreadUnregisterDev(pInfo->fd);
-    else
+    } else {
+	xf86RemoveSIGIOHandler(pInfo->fd);
 	RemoveEnabledDevice(pInfo->fd);
+    }
 }
 
 static int *xf86SignalIntercept = NULL;
-- 
1.7.3.2



More information about the xorg-devel mailing list