From owner-freebsd-hackers Sun May 16 1:42:43 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from hydrogen.fircrest.net (metriclient-2.uoregon.edu [128.223.172.2]) by hub.freebsd.org (Postfix) with ESMTP id 099A51521A for ; Sun, 16 May 1999 01:42:37 -0700 (PDT) (envelope-from gurney_j@efn.org) Received: (from jmg@localhost) by hydrogen.fircrest.net (8.9.1/8.8.7) id BAA04113; Sun, 16 May 1999 01:42:19 -0700 (PDT) Message-ID: <19990516014219.56752@hydrogen.nike.efn.org> Date: Sun, 16 May 1999 01:42:19 -0700 From: John-Mark Gurney To: John Birrell Cc: dlombardo@excite.com, hackers@FreeBSD.ORG Subject: Re: threads and Xlibs? References: <19990516003125.15800@hydrogen.nike.efn.org> <199905160758.RAA12380@cimlogic.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.69 In-Reply-To: <199905160758.RAA12380@cimlogic.com.au>; from John Birrell on Sun, May 16, 1999 at 05:58:51PM +1000 Reply-To: John-Mark Gurney Organization: Cu Networking X-Operating-System: FreeBSD 3.0-RELEASE i386 X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31 96 7A 22 B3 D8 56 36 F4 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG John Birrell scribbled this message on May 16: > 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. yes, but this is what compiling Xlib with threading support is suppose to fix this so that you don't have problems... I haven't exactly looked at what the threading support DOES for Xlib though, but I did manage to make it so that XInitThreads() would return true, but I never did get around to making more exhaustive tests... hmmm... wonder why I don't have libX11.a and friends compiled, I know that I had it when I saved the work off... -- John-Mark Gurney Voice: +1 541 684 8449 Cu Networking P.O. Box 5693, 97405 "The soul contains in itself the event that shall presently befall it. The event is only the actualizing of its thought." -- Ralph Waldo Emerson To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message