[PATCH 2/4] X event queue mutex
Peter Hutterer
peter.hutterer at who-t.net
Mon Nov 3 22:08:06 PST 2008
On Mon, Nov 03, 2008 at 09:41:48PM -0800, Jeremy Huddleston wrote:
> That looks much better (and is much more readable), but it's still open
> to data-thrashing when the queue is full. Move this:
>
> miEventQueue.head = (miEventQueue.head + 1) % QUEUE_SIZE;
>
> after this:
>
> + for (i = 0; i < nevents; i++)
> + memcpy(&event[i], e->events[i].event, evlen);
>
> e is the head, and it becomes "writeable" by the other thread after we
> do the pop... so we want to only pop it after we're done copying.
>
> With that change, I think it's golden =)
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.
More information about the xorg
mailing list