Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 May 1999 01:42:19 -0700
From:      John-Mark Gurney <gurney_j@efn.org>
To:        John Birrell <jb@cimlogic.com.au>
Cc:        dlombardo@excite.com, hackers@FreeBSD.ORG
Subject:   Re: threads and Xlibs?
Message-ID:  <19990516014219.56752@hydrogen.nike.efn.org>
In-Reply-To: <199905160758.RAA12380@cimlogic.com.au>; from John Birrell on Sun, May 16, 1999 at 05:58:51PM %2B1000
References:  <19990516003125.15800@hydrogen.nike.efn.org> <199905160758.RAA12380@cimlogic.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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