diff options
author | marha <marha@users.sourceforge.net> | 2013-11-19 07:52:09 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-11-19 07:52:09 +0100 |
commit | 73db05c85f7a8cf2439f7c333ede6ff2dc4877d7 (patch) | |
tree | 99d99330efd4e8270d3c40a58a3b1576d9780f75 /libxcb/src/xcb_out.c | |
parent | 7c20de6c7fb53ed404d4df0d975328318810ce01 (diff) | |
download | vcxsrv-73db05c85f7a8cf2439f7c333ede6ff2dc4877d7.tar.gz vcxsrv-73db05c85f7a8cf2439f7c333ede6ff2dc4877d7.tar.bz2 vcxsrv-73db05c85f7a8cf2439f7c333ede6ff2dc4877d7.zip |
libxcb xcb-proto xserver mesa git update 19 nov 2013
xserver commit da9997f89f14ab619f244d5b2e80a423b028c789
libxcb commit 5d1dbb468bb0f834eaa8adea6daf6729808ca429
libxcb/xcb-proto commit 281790373e625cc1e9f67b39fe0d687f279edbfb
mesa commit 21ae5135dd30bbd2ec7d2b44e07b6cb1d6425d9e
Diffstat (limited to 'libxcb/src/xcb_out.c')
-rw-r--r-- | libxcb/src/xcb_out.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/libxcb/src/xcb_out.c b/libxcb/src/xcb_out.c index 1a3aca515..18bb5f912 100644 --- a/libxcb/src/xcb_out.c +++ b/libxcb/src/xcb_out.c @@ -86,24 +86,21 @@ static void send_sync(xcb_connection_t *c) static void get_socket_back(xcb_connection_t *c) { - while (c->out.return_socket) { - /* we are about to release the lock, - so make a copy of the current status */ - xcb_return_socket_func_t return_socket = c->out.return_socket; - void *socket_closure = c->out.socket_closure; - int socket_seq = c->out.socket_seq; - - pthread_mutex_unlock(&c->iolock); - return_socket(socket_closure); - pthread_mutex_lock(&c->iolock); - - /* make sure nobody else has acquired the socket */ - if (socket_seq == c->out.socket_seq) { - c->out.return_socket = 0; - c->out.socket_closure = 0; - _xcb_in_replies_done(c); - } - } + while(c->out.return_socket && c->out.socket_moving) + pthread_cond_wait(&c->out.socket_cond, &c->iolock); + if(!c->out.return_socket) + return; + + c->out.socket_moving = 1; + pthread_mutex_unlock(&c->iolock); + c->out.return_socket(c->out.socket_closure); + pthread_mutex_lock(&c->iolock); + c->out.socket_moving = 0; + + pthread_cond_broadcast(&c->out.socket_cond); + c->out.return_socket = 0; + c->out.socket_closure = 0; + _xcb_in_replies_done(c); } /* Public interface */ @@ -299,7 +296,6 @@ int xcb_take_socket(xcb_connection_t *c, void (*return_socket)(void *closure), v { c->out.return_socket = return_socket; c->out.socket_closure = closure; - ++c->out.socket_seq; if(flags) _xcb_in_expect_reply(c, c->out.request, WORKAROUND_EXTERNAL_SOCKET_OWNER, flags); assert(c->out.request == c->out.request_written); @@ -336,9 +332,11 @@ int xcb_flush(xcb_connection_t *c) int _xcb_out_init(_xcb_out *out) { + if(pthread_cond_init(&out->socket_cond, 0)) + return 0; out->return_socket = 0; out->socket_closure = 0; - out->socket_seq = 0; + out->socket_moving = 0; if(pthread_cond_init(&out->cond, 0)) return 0; |