summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2006-02-27 02:57:36 -0800
committerJamey Sharp <jamey@minilop.net>2006-02-27 02:57:36 -0800
commit731c85762d8994119f4eaf572cc59c9adbb7abd9 (patch)
tree5fd7ccda69a9c278ca98fd12896b9aad6cabcb1b
parent8ab4dcde9db8175ef0093123bd04c72471e205ff (diff)
Move test for other writing threads *before* allocating a sequence number.
-rw-r--r--src/xcb_out.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/xcb_out.c b/src/xcb_out.c
index 8eb8a7a..762efbd 100644
--- a/src/xcb_out.c
+++ b/src/xcb_out.c
@@ -170,6 +170,10 @@ int XCBSendRequest(XCBConnection *c, unsigned int *request, int flags, struct io
return -1;
}
+ /* wait for other writing threads to get out of my way. */
+ while(c->out.writing)
+ pthread_cond_wait(&c->out.cond, &c->iolock);
+
*request = ++c->out.request;
_xcb_in_expect_reply(c, *request, workaround, flags);
@@ -250,8 +254,6 @@ int _xcb_out_write(XCBConnection *c)
int _xcb_out_write_block(XCBConnection *c, struct iovec *vector, size_t count)
{
- while(c->out.writing)
- pthread_cond_wait(&c->out.cond, &c->iolock);
assert(!c->out.vec && !c->out.vec_len);
while(count && c->out.queue_len + vector[0].iov_len < sizeof(c->out.queue))
{