[PATCH 2/4] X event queue mutex

Jeremy Huddleston jeremyhu at freedesktop.org
Fri Nov 7 10:52:51 PST 2008


On Nov 6, 2008, at 20:52, Tiago Vignatti wrote:

> 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.

Well the problem was that mieqProcessInputEvents DOESN'T use those  
locks, so it can read the incremented value of miEventQueue.tail  
thinking that the item at head=tail-1 is ready to read when in fact  
mieqEnqueue is still in the process of writing to it.

Further, mieqEnqueue sometimes edits miEventQueue.tail-1 (when the  
current and tail-1 events are MotionNotify)... but  
mieqProcessInputEvents is already reading it.

For this reason, I went back to locking inside mieqProcessInputEvents  
with XQUARTZ.

--Jeremy

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3040 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20081107/c12aa40d/attachment.bin>


More information about the xorg mailing list