Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 May 1999 17:58:51 +1000 (EST)
From:      John Birrell <jb@cimlogic.com.au>
To:        gurney_j@resnet.uoregon.edu
Cc:        dlombardo@excite.com, hackers@FreeBSD.ORG
Subject:   Re: threads and Xlibs?
Message-ID:  <199905160758.RAA12380@cimlogic.com.au>
In-Reply-To: <19990516003125.15800@hydrogen.nike.efn.org> from John-Mark Gurney at "May 16, 1999  0:31:25 am"

next in thread | previous in thread | raw e-mail | index | archive | help
John-Mark Gurney wrote:
> Dean Lombardo scribbled this message on May 16:
> > Why does X have multi-thread support disabled by default?
> > 
> > Quite a few programs (e.g. freeamp) give nasty "Xlib: unexpected async
> > reply" errors due to making X calls from more than one thread.
> > 
> > Now that threads and libc_r are part of the system (and have been for a
> > while), perhaps Xlibs should be built thread-safe?
> > 
> > Has anyone trying compiling XFree86 with multi-thread support enabled?
> 
> yeh, I did that a few months ago using the Xlib direct from the
> X Consortium, and it's a PITA... I can try updating the port, but there
> are SOO many hacks to the build environment, that it would probably be
> better for someone who actually knows the Xlib build environment to go
> over my patches...

There is not much point. You only have one connection to the X server
per application context. Using more than one thread per fd leads to
confusion as to which thread is supposed to deal with incoming X events
and likely creates problems with thread safety in other areas of your
application. If you use more than one application context, you get
poor behaviour from menu widgets IMHO.

It makes more sense to do (as I do) and do all Xlib calls in the initial
thread, with child threads to do anything else that can block. In general,
having more than one thread per thing that can block is a bad idea.

-- 
John Birrell - jb@cimlogic.com.au; jb@freebsd.org http://www.cimlogic.com.au/
CIMlogic Pty Ltd, GPO Box 117A, Melbourne Vic 3001, Australia +61 418 353 137


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199905160758.RAA12380>