Refactor XCBPollForEvent with a shorter critical section.
This simplifies the patch for bug #8208 later.
This commit is contained in:
parent
b08ca2b4b4
commit
df7fb77d6e
18
src/xcb_in.c
18
src/xcb_in.c
|
@ -380,21 +380,27 @@ XCBGenericEvent *XCBWaitForEvent(XCBConnection *c)
|
||||||
XCBGenericEvent *XCBPollForEvent(XCBConnection *c, int *error)
|
XCBGenericEvent *XCBPollForEvent(XCBConnection *c, int *error)
|
||||||
{
|
{
|
||||||
XCBGenericEvent *ret = 0;
|
XCBGenericEvent *ret = 0;
|
||||||
|
int success;
|
||||||
pthread_mutex_lock(&c->iolock);
|
pthread_mutex_lock(&c->iolock);
|
||||||
|
/* FIXME: follow X meets Z architecture changes. */
|
||||||
|
success = _xcb_in_read(c);
|
||||||
|
if(success)
|
||||||
|
ret = get_event(c);
|
||||||
|
pthread_mutex_unlock(&c->iolock);
|
||||||
|
if(success)
|
||||||
|
{
|
||||||
if(error)
|
if(error)
|
||||||
*error = 0;
|
*error = 0;
|
||||||
/* FIXME: follow X meets Z architecture changes. */
|
return ret;
|
||||||
if(_xcb_in_read(c))
|
}
|
||||||
ret = get_event(c);
|
if(error)
|
||||||
else if(error)
|
|
||||||
*error = -1;
|
*error = -1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "XCBPollForEvent: I/O error occured, but no handler provided.\n");
|
fprintf(stderr, "XCBPollForEvent: I/O error occured, but no handler provided.\n");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&c->iolock);
|
return 0;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XCBGenericError *XCBRequestCheck(XCBConnection *c, XCBVoidCookie cookie)
|
XCBGenericError *XCBRequestCheck(XCBConnection *c, XCBVoidCookie cookie)
|
||||||
|
|
Loading…
Reference in New Issue