[PATCH 2/4] X event queue mutex
Jeremy Huddleston
jeremyhu at freedesktop.org
Tue Nov 4 09:34:23 PST 2008
On Nov 3, 2008, at 22:08, Peter Hutterer wrote:
...
> righty-o. hunk 2 is different, with the change you suggested. To make
> the flow cleaner, I moved all the EQ and memory alloc stuff together
> and the
> copies into local variables below it.
Almost... you need to move the pop down 4 lines. ie this:
<bad>
miEventQueue.head = (miEventQueue.head + 1) % QUEUE_SIZE;
+ dev = e->pDev;
+ master = (!dev->isMaster && dev->u.master) ? dev->u.master :
NULL;
+ type = e->events->event->u.u.type;
+ screen = e->pScreen;
+
</bad>
should be this:
<good>
+ dev = e->pDev;
+ master = (!dev->isMaster && dev->u.master) ? dev->u.master :
NULL;
+ type = e->events->event->u.u.type;
+ screen = e->pScreen;
+
miEventQueue.head = (miEventQueue.head + 1) % QUEUE_SIZE;
</good>
After you increment miEventQueue.head, you can't read from e. ... so
you could also do this if you wanted to be anal about popping quickly:
<good>
+ dev = e->pDev;
+ screen = e->pScreen;
+
miEventQueue.head = (miEventQueue.head + 1) % QUEUE_SIZE;
+ type = event->u.u.type;
+ master = (!dev->isMaster && dev->u.master) ? dev->u.master :
NULL;
</good>
--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/20081104/363f1aa7/attachment.bin>
More information about the xorg
mailing list