[Xcb] Assertion `c->out.request == c->out.request_written' failed
Keith Packard
keithp at keithp.com
Thu Dec 1 03:10:54 PST 2011
This was pretty easy to fix -- xcb_take_socket just needs to loop until
the requests queue is actually flushed as _xcb_out_flush may drop the
iolock and let some other thread come back in and queue a request.
From 0297a46f008186a56826f5a2c7621dd7b4b69718 Mon Sep 17 00:00:00 2001
From: Keith Packard <keithp at keithp.com>
Date: Thu, 1 Dec 2011 10:28:51 +0000
Subject: [PATCH] Make xcb_take_socket keep flushing until idle
_xcb_out_flush_to will drop the iolock in pthread_cond_wait allowing
other threads to queue new requests. When this happened,
there would be requests queued for the socket after _xcb_out_flush_to
returned, and xcb_take_socket would throw an assert.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=29875
Signed-off-by: Keith Packard <keithp at keithp.com>
---
src/xcb_out.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/src/xcb_out.c b/src/xcb_out.c
index 5eb1e42..d6082fc 100644
--- a/src/xcb_out.c
+++ b/src/xcb_out.c
@@ -263,7 +263,13 @@ int xcb_take_socket(xcb_connection_t *c, void (*return_socket)(void *closure), v
return 0;
pthread_mutex_lock(&c->iolock);
get_socket_back(c);
- ret = _xcb_out_flush_to(c, c->out.request);
+
+ /* _xcb_out_flush may drop the iolock allowing other threads to
+ * write requests, so keep flushing until we're done
+ */
+ do
+ ret = _xcb_out_flush_to(c, c->out.request);
+ while (ret && c->out.request != c->out.request_written);
if(ret)
{
c->out.return_socket = return_socket;
--
1.7.7.3
--
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/xcb/attachments/20111201/c5e79fcb/attachment.pgp>
More information about the Xcb
mailing list