/* 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;
++c->in.reading;
FD_ZERO(&wfds);
- if(should_write)
+ if(count)
{
FD_SET(c->fd, &wfds);
++c->out.writing;
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;
* 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)
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);
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;
_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