Move c->out.vec refs out of _xcb_conn_wait up to _xcb_out_flush.
This commit is contained in:
parent
621f891c49
commit
83e652f566
|
@ -198,13 +198,13 @@ void XCBDisconnect(XCBConnection *c)
|
||||||
|
|
||||||
/* Private interface */
|
/* 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;
|
int ret;
|
||||||
fd_set rfds, wfds;
|
fd_set rfds, wfds;
|
||||||
|
|
||||||
/* If the thing I should be doing is already being done, wait for it. */
|
/* 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);
|
pthread_cond_wait(cond, &c->iolock);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -215,7 +215,7 @@ int _xcb_conn_wait(XCBConnection *c, const int should_write, pthread_cond_t *con
|
||||||
++c->in.reading;
|
++c->in.reading;
|
||||||
|
|
||||||
FD_ZERO(&wfds);
|
FD_ZERO(&wfds);
|
||||||
if(should_write)
|
if(count)
|
||||||
{
|
{
|
||||||
FD_SET(c->fd, &wfds);
|
FD_SET(c->fd, &wfds);
|
||||||
++c->out.writing;
|
++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);
|
ret = ret && _xcb_in_read(c);
|
||||||
|
|
||||||
if(FD_ISSET(c->fd, &wfds))
|
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->out.writing;
|
||||||
--c->in.reading;
|
--c->in.reading;
|
||||||
|
|
||||||
|
|
|
@ -269,7 +269,7 @@ void *XCBWaitForReply(XCBConnection *c, unsigned int request, XCBGenericError **
|
||||||
* wait for one. */
|
* wait for one. */
|
||||||
while(c->in.request_completed < request &&
|
while(c->in.request_completed < request &&
|
||||||
!(c->in.request_read == request && c->in.current_reply))
|
!(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;
|
goto done;
|
||||||
|
|
||||||
if(c->in.request_read != request)
|
if(c->in.request_read != request)
|
||||||
|
@ -329,7 +329,7 @@ XCBGenericEvent *XCBWaitForEvent(XCBConnection *c)
|
||||||
pthread_mutex_lock(&c->iolock);
|
pthread_mutex_lock(&c->iolock);
|
||||||
/* get_event returns 0 on empty list. */
|
/* get_event returns 0 on empty list. */
|
||||||
while(!(ret = get_event(c)))
|
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;
|
break;
|
||||||
|
|
||||||
wake_up_next_reader(c);
|
wake_up_next_reader(c);
|
||||||
|
|
|
@ -272,7 +272,7 @@ int _xcb_out_flush(XCBConnection *c)
|
||||||
c->out.queue_len = 0;
|
c->out.queue_len = 0;
|
||||||
}
|
}
|
||||||
while(ret && c->out.vec_len)
|
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;
|
c->out.request_written = c->out.request;
|
||||||
pthread_cond_broadcast(&c->out.cond);
|
pthread_cond_broadcast(&c->out.cond);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -157,7 +157,7 @@ struct XCBConnection {
|
||||||
_xcb_xid xid;
|
_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
|
#ifdef GCC_HAS_VISIBILITY
|
||||||
#pragma GCC visibility pop
|
#pragma GCC visibility pop
|
||||||
|
|
Loading…
Reference in New Issue