From 83e652f566671f96ffc53a3c0099a84a1606c695 Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Thu, 9 Mar 2006 00:02:42 -0800 Subject: [PATCH] Move c->out.vec refs out of _xcb_conn_wait up to _xcb_out_flush. --- src/xcb_conn.c | 10 +++++----- src/xcb_in.c | 4 ++-- src/xcb_out.c | 2 +- src/xcbint.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/xcb_conn.c b/src/xcb_conn.c index 0491721..792dfb8 100644 --- a/src/xcb_conn.c +++ b/src/xcb_conn.c @@ -198,13 +198,13 @@ void XCBDisconnect(XCBConnection *c) /* Private interface */ -int _xcb_conn_wait(XCBConnection *c, const int should_write, pthread_cond_t *cond) +int _xcb_conn_wait(XCBConnection *c, pthread_cond_t *cond, struct iovec **vector, int *count) { int ret; fd_set rfds, wfds; /* If the thing I should be doing is already being done, wait for it. */ - if(should_write ? c->out.writing : c->in.reading) + if(count ? c->out.writing : c->in.reading) { pthread_cond_wait(cond, &c->iolock); return 1; @@ -215,7 +215,7 @@ int _xcb_conn_wait(XCBConnection *c, const int should_write, pthread_cond_t *con ++c->in.reading; FD_ZERO(&wfds); - if(should_write) + if(count) { FD_SET(c->fd, &wfds); ++c->out.writing; @@ -231,10 +231,10 @@ int _xcb_conn_wait(XCBConnection *c, const int should_write, pthread_cond_t *con ret = ret && _xcb_in_read(c); if(FD_ISSET(c->fd, &wfds)) - ret = ret && _xcb_out_write(c, &c->out.vec, &c->out.vec_len); + ret = ret && _xcb_out_write(c, vector, count); } - if(should_write) + if(count) --c->out.writing; --c->in.reading; diff --git a/src/xcb_in.c b/src/xcb_in.c index ea851c7..fe9a873 100644 --- a/src/xcb_in.c +++ b/src/xcb_in.c @@ -269,7 +269,7 @@ void *XCBWaitForReply(XCBConnection *c, unsigned int request, XCBGenericError ** * wait for one. */ while(c->in.request_completed < request && !(c->in.request_read == request && c->in.current_reply)) - if(!_xcb_conn_wait(c, /*should_write*/ 0, &cond)) + if(!_xcb_conn_wait(c, &cond, 0, 0)) goto done; if(c->in.request_read != request) @@ -329,7 +329,7 @@ XCBGenericEvent *XCBWaitForEvent(XCBConnection *c) pthread_mutex_lock(&c->iolock); /* get_event returns 0 on empty list. */ while(!(ret = get_event(c))) - if(!_xcb_conn_wait(c, /*should_write*/ 0, &c->in.event_cond)) + if(!_xcb_conn_wait(c, &c->in.event_cond, 0, 0)) break; wake_up_next_reader(c); diff --git a/src/xcb_out.c b/src/xcb_out.c index c84a27c..ba60d3f 100644 --- a/src/xcb_out.c +++ b/src/xcb_out.c @@ -272,7 +272,7 @@ int _xcb_out_flush(XCBConnection *c) c->out.queue_len = 0; } while(ret && c->out.vec_len) - ret = _xcb_conn_wait(c, /*should_write*/ 1, &c->out.cond); + ret = _xcb_conn_wait(c, &c->out.cond, &c->out.vec, &c->out.vec_len); c->out.request_written = c->out.request; pthread_cond_broadcast(&c->out.cond); return ret; diff --git a/src/xcbint.h b/src/xcbint.h index e6f540a..a8287e8 100644 --- a/src/xcbint.h +++ b/src/xcbint.h @@ -157,7 +157,7 @@ struct XCBConnection { _xcb_xid xid; }; -int _xcb_conn_wait(XCBConnection *c, const int should_write, pthread_cond_t *cond); +int _xcb_conn_wait(XCBConnection *c, pthread_cond_t *cond, struct iovec **vector, int *count); #ifdef GCC_HAS_VISIBILITY #pragma GCC visibility pop -- 2.34.1