[Xcb] Thread safety of XCB.

John Found johnfound at evrocom.net
Tue Oct 2 13:43:42 PDT 2012


I am trying to use XLib (based on XCB) in multithreaded application, where the threads are created by direct call to sys_clone.
Unfortunately, when several threads calls XLib functions, the application crashes with following message:

>>>../../src/xcb_io.c:378: _XAllocID: Assertion `ret != inval_id' failed.

What is the reason for this crash? What XCB expects from the threads in order to be "thread safe"?

The clone flags I use are: CLONE_SIGHAND, CLONE_THREAD, CLONE_FILES, CLONE_FS, CLONE_VM, CLONE_PTRACE, CLONE_PARENT
The created threads actually works and terminates as expected, with one exception - XCB (XLib) calls.

When I try the same, but using pthread library everything works fine, but I can't use pthread library in this application.
It must be sys_call that to be used for thread creation.

-- 
John Found 
http://asm32.hopto.org


More information about the Xcb mailing list