From owner-freebsd-hackers Sun May 16 0:46:30 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from cimlogic.com.au (cimlog.lnk.telstra.net [139.130.51.31]) by hub.freebsd.org (Postfix) with ESMTP id 78CC5152C0 for ; Sun, 16 May 1999 00:46:23 -0700 (PDT) (envelope-from jb@cimlogic.com.au) Received: (from jb@localhost) by cimlogic.com.au (8.9.1/8.9.1) id RAA12380; Sun, 16 May 1999 17:58:51 +1000 (EST) (envelope-from jb) From: John Birrell Message-Id: <199905160758.RAA12380@cimlogic.com.au> Subject: Re: threads and Xlibs? In-Reply-To: <19990516003125.15800@hydrogen.nike.efn.org> from John-Mark Gurney at "May 16, 1999 0:31:25 am" To: gurney_j@resnet.uoregon.edu Date: Sun, 16 May 1999 17:58:51 +1000 (EST) Cc: dlombardo@excite.com, hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL43 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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