X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fxcb_xlib.c;h=f352ca2fb71cbd02762bf5c5ec9375c24c618cec;hb=40589db8124b8c72894deb86a825c6117b0a2cd2;hp=09f74a731b9486f69bf6732e7c6d7cc8db89cdab;hpb=6e29e5f2ee2e6158f1a9480a83e4f906ab9c04d1;p=free-sw%2Fxcb%2Flibxcb diff --git a/src/xcb_xlib.c b/src/xcb_xlib.c index 09f74a7..f352ca2 100644 --- a/src/xcb_xlib.c +++ b/src/xcb_xlib.c @@ -26,17 +26,37 @@ #include "xcbxlib.h" #include "xcbint.h" -unsigned int XCBGetQueuedRequestRead(XCBConnection *c) -{ - return c->in.request_read; -} +#include -unsigned int XCBGetRequestSent(XCBConnection *c) +unsigned int xcb_get_request_sent(xcb_connection_t *c) { + if(c->has_error) + return 0; return c->out.request; } -pthread_mutex_t *XCBGetIOLock(XCBConnection *c) +pthread_mutex_t *xcb_get_io_lock(xcb_connection_t *c) { + if(c->has_error) + return 0; return &c->iolock; } + +void xcb_xlib_lock(xcb_connection_t *c) +{ + _xcb_lock_io(c); + assert(!c->xlib.lock); + c->xlib.lock = 1; + c->xlib.thread = pthread_self(); + _xcb_unlock_io(c); +} + +void xcb_xlib_unlock(xcb_connection_t *c) +{ + _xcb_lock_io(c); + assert(c->xlib.lock); + assert(pthread_equal(c->xlib.thread, pthread_self())); + c->xlib.lock = 0; + pthread_cond_broadcast(&c->xlib.cond); + _xcb_unlock_io(c); +}