[Xcb] XCB on *BSD: many pthread-related problems
Jamey Sharp
jamey at minilop.net
Fri Nov 3 22:24:39 PST 2006
First off, thanks for testing XCB on non-Linux. :-)
On Fri, Nov 03, 2006 at 09:46:57PM +0100, Diego 'Flameeyes' Pettenò wrote:
> So, I've been trying to find why X didn't start after having it built fine
> with xcb enabled... and I've seen there's a little big mess with it on
> FreeBSD (and DragonFly and OpenBSD at least, not sure on NetBSD, but it's
> likely to be the same).
I'm very surprised that you're having trouble on FreeBSD, because I
believe Eric Anholt has been testing this code on that OS, and I'm sure
he'd have complained at me if he'd seen this problem.
I'm also not convinced I understand the symptom you're seeing. Your X
server surely starts just fine, right? (Try just running `X` from the
console: you should see the lovely root weave.) I assume the problem is
that your applications fail to load and startx or xdm or whatever you're
using kills the X server as a result.
Anyway, I'll address your actual problem; I just want to understand the
symptom too.
(fascinating background snipped)
> libX11 wasn't threaded previously, but libxcb and libxcb-xlib are now. The
> result is that programs linking to libX11 will now need to use -pthread to
> finalise the link, or they won't work.
Actually, libX11 and XCB still aren't (exclusively) threaded libraries.
They're meant to work with both multi-threaded and single-threaded
programs. So I suspect you have the wrong fix.
Josh has been planning to write what I think is the correct fix for your
problem. It's worrisome that he was inspired to do this because the Hurd
needs it, but we'll let that pass... ;-)
On Linux and some other platforms, libc provides weak symbols for the
pthread functions we're using. If you don't link a pthread library, then
calls to those functions go to the libc versions, which do nothing.
Otherwise, the calls go to the real thread implementation, which
actually acquires a lock or whatever. Currently, we rely on this
behavior.
What Josh planned to do is embed our own no-op weak symbols in XCB on
platforms where libc doesn't provide them. I think only ELF supports
weak symbols, so on non-ELF platforms we may need a third solution, but
I don't think that's an issue yet.
libX11 has code for this. See where configure.ac defines thrstubs, and
see src/UIThrStubs.c. (And why isn't this code enough for your system?
Pure XCB apps would fail, but Xlib apps ought to still work.)
If you wanted to try your hand at such a patch for XCB, it'd be a big
help. Josh is quite busy...
--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/20061103/7d2870b3/attachment.pgp
More information about the Xcb
mailing list