[PATCH 4/5] xfree86: Reduce SIGIO block/unblock traffic

Tiago Vignatti tiago.vignatti at nokia.com
Fri Dec 17 05:19:30 PST 2010


On Thu, Dec 16, 2010 at 03:31:39PM -0500, ext Adam Jackson wrote:
> Push/pop the SIGIO block outside the loop rather than every time through
> it.

I didn't get why we even need this SIGIO actually there. Can you clarify a
bit? 

 
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  hw/xfree86/common/xf86Events.c |    9 +++++----
>  1 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
> index 84c0d18..6561292 100644
> --- a/hw/xfree86/common/xf86Events.c
> +++ b/hw/xfree86/common/xf86Events.c
> @@ -250,11 +250,12 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask)
>  
>  	XFD_ANDSET(&devicesWithInput, LastSelectMask, &EnabledDevices);
>  	if (XFD_ANYSET(&devicesWithInput)) {
> +	    int sigstate = xf86BlockSIGIO();
>  	    pInfo = xf86InputDevs;
> +
>  	    while (pInfo) {
>  		if (pInfo->read_input && pInfo->fd >= 0 &&
>  		    (FD_ISSET(pInfo->fd, &devicesWithInput) != 0)) {
> -		    int sigstate = xf86BlockSIGIO();
>  
>  		    /*
>  		     * Remove the descriptior from the set because more than one
> @@ -263,10 +264,10 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask)
>  		    FD_CLR(pInfo->fd, &devicesWithInput);
>  
>  		    pInfo->read_input(pInfo);
> -		    xf86UnblockSIGIO(sigstate);
>  		}
>  		pInfo = pInfo->next;
>  	    }
> +	    xf86UnblockSIGIO(sigstate);
>  	}
>      }
>  
> @@ -394,17 +395,17 @@ xf86ReleaseKeys(DeviceIntPtr pDev)
>       * are reenabled.
>       */
>  
> +    sigstate = xf86BlockSIGIO ();
>      for (i = keyc->xkbInfo->desc->min_key_code;
>           i < keyc->xkbInfo->desc->max_key_code;
>           i++) {
>          if (key_is_down(pDev, i, KEY_POSTED)) {
> -            sigstate = xf86BlockSIGIO ();
>              nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i);
>              for (j = 0; j < nevents; j++)
>                  mieqEnqueue(pDev, (InternalEvent*)(xf86Events + j)->event);
> -            xf86UnblockSIGIO(sigstate);
>          }
>      }
> +    xf86UnblockSIGIO(sigstate);
>  }
>  
>  /*
> -- 
> 1.7.3.2
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
             Tiago


More information about the xorg-devel mailing list