[PATCH 2/4] X event queue mutex

Tiago Vignatti vignatti at c3sl.ufpr.br
Thu Nov 6 20:52:20 PST 2008


Hey,

Jeremy Huddleston escreveu:
> Looks good!  A recent bug report has surfaced for us since I got rid of 
> the locking in mieqProcessInputEvents.  We need to update 
> miEventQueue.tail only after the data has actually been pushed into the 
> tail.  This should take care of that problem on master, but I haven't 
> tested it:

Well, it won't be a problem with Xorg input thread because mieqEnqueue 
is tread-safe. There's a mutex protecting writes to the tail pointer in 
that function and xquartz will need it as well.


> diff --git a/mi/mieq.c b/mi/mieq.c
> index 062dede..5016d73 100644
> --- a/mi/mieq.c
> +++ b/mi/mieq.c
> @@ -122,7 +122,8 @@ mieqResizeEvents(int min_size)
>  void
>  mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
>  {
> -    unsigned int           oldtail = miEventQueue.tail, newtail;
> +    unsigned int           oldtail = miEventQueue.tail;
> +    unsigned int           newtail = oldtail;
>      EventListPtr           evt;
>      int                    isMotion = 0;
>      int                    evlen;
> @@ -184,7 +185,6 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
>          return;
>          }
>      stuck = 0;
> -    miEventQueue.tail = newtail;
>      }
> 
>      evlen = sizeof(xEvent);
> @@ -218,6 +218,7 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
>      miEventQueue.events[oldtail].pDev = pDev;
> 
>      miEventQueue.lastMotion = isMotion;
> +    miEventQueue.tail = newtail;
>  }

Anyway this patch is not good enough. newtail is also deferenced (line 
173) before his first usage, making the first hunk not utilized.


Thanks,

-- 
Tiago Vignatti
C3SL - Centro de Computação Científica e Software Livre
www.c3sl.ufpr.br



More information about the xorg mailing list