#include "xcbxlib.h"
#include "xcbint.h"
-unsigned int XCBGetQueuedRequestRead(XCBConnection *c)
+#include <assert.h>
+
+unsigned int xcb_get_request_sent(xcb_connection_t *c)
{
- return c->in.request_read;
+ if(c->has_error)
+ return 0;
+ return c->out.request;
}
-unsigned int XCBGetRequestSent(XCBConnection *c)
+void xcb_xlib_lock(xcb_connection_t *c)
{
- return c->out.request;
+ _xcb_lock_io(c);
+ assert(!c->xlib.lock);
+ c->xlib.lock = 1;
+ c->xlib.thread = pthread_self();
+ _xcb_unlock_io(c);
}
-pthread_mutex_t *XCBGetIOLock(XCBConnection *c)
+void xcb_xlib_unlock(xcb_connection_t *c)
{
- return &c->iolock;
+ _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);
}