diff options
author | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-11-19 10:54:57 -0800 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-11-19 10:54:57 -0800 |
commit | 56d1793c435abbaababab031860f1160f09fff06 (patch) | |
tree | 9cbd3e41d13616dfdd2413458fcc21c89381d8d8 /mi | |
parent | 570835b9a89187a36e08defbccc56051bb349b52 (diff) |
mi: Only increment tail (push) when the event data is actually in the queue
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Tiago Vignatti <vignatti@c3sl.ufpr.br>
Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
Diffstat (limited to 'mi')
-rw-r--r-- | mi/mieq.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -122,7 +122,7 @@ mieqResizeEvents(int min_size) void mieqEnqueue(DeviceIntPtr pDev, xEvent *e) { - unsigned int oldtail = miEventQueue.tail, newtail; + unsigned int oldtail = miEventQueue.tail; EventListPtr evt; int isMotion = 0; int evlen; @@ -170,11 +170,10 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e) } else { static int stuck = 0; - newtail = (oldtail + 1) % QUEUE_SIZE; /* Toss events which come in late. Usually this means your server's * stuck in an infinite loop somewhere, but SIGIO is still getting * handled. */ - if (newtail == miEventQueue.head) { + if (((oldtail + 1) % QUEUE_SIZE) == miEventQueue.head) { ErrorF("[mi] EQ overflowing. The server is probably stuck " "in an infinite loop.\n"); if (!stuck) { @@ -184,7 +183,6 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e) return; } stuck = 0; - miEventQueue.tail = newtail; } evlen = sizeof(xEvent); @@ -218,6 +216,7 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e) miEventQueue.events[oldtail].pDev = pDev; miEventQueue.lastMotion = isMotion; + miEventQueue.tail = (oldtail + 1) % QUEUE_SIZE; } void |