[Xcb] how should Xlib handle threads?

Jamey Sharp jamey at minilop.net
Sat Dec 24 11:16:42 PST 2005


On Sat, Dec 24, 2005 at 10:17:19AM -0800, Barton C Massey wrote:
> I'm obviously not understanding.  Why not just provide a
> call in the XCB API that does what Xlib wants, i.e. queues a
> request and assigns a sequence number?  Doesn't XCB already
> know how to do this pretty well?

XCB does it beautifully (if I do say so myself) using the XCBSendRequest
function. However, Xlib can't use it correctly.

Xlib functions call the GetReq family of macros to do what
XCBSendRequest does; these macros all look roughly like this:

#define GetReq(name, req) \
        WORD64ALIGN\
        if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\
                _XFlush(dpy);\
        req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\
        req->reqType = X_##name;\
        req->length = (SIZEOF(x##name##Req))>>2;\
        dpy->bufptr += SIZEOF(x##name##Req);\
        dpy->request++

Since these macros are defined in Xlibint.h and used by extension
libraries, I can't change them. Even if I could, they're used too early
to call XCBSendRequest, because it requires that the entire request be
provided all at once.

So I'm reduced to waiting for the Display to become unlocked, figuring
out what requests Xlib generated, and then passing them along to XCB.

Does that make the problem clearer?

--Jamey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/xcb/attachments/20051224/7bcd4033/attachment.pgp


More information about the Xcb mailing list