X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fxcb_out.c;h=762efbd20eb41b448eb0515db1dac11a828a9d08;hb=731c85762d8994119f4eaf572cc59c9adbb7abd9;hp=8eb8a7a6d2b0ea0bc9133357c7aaa37db206d36a;hpb=ff7b6c9124e7caf26381cc7a10fba9eaf1875652;p=free-sw%2Fxcb%2Flibxcb 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)) {