[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Debian, threads, and X.



Can Linux support the new thread safety features in X11R6?

We've been working on some projects here (robotics and vision) for
which we have needed threads.  We obtained the latest pthreads
(Provenzano's) and it has more or less worked OK.  (It's compiler (a
gcc wrapper script) overrides many libc functions with thread safe
ones (i.e. stdio) so things don't break.)  We might not have had to do
this, but unfortunately the threads lib that gets built with libc is
out of date, and kind of broken, but that's another story.

Our system uses X for display.  Until recently, X was not thread safe,
and we sort of hacked up something by putting a global mutex around
*all* X calls.  This worked most of the time, but not for all cases
since X was compiled using stdio macros which can't be retroactively
made thread safe (i.e. pthreads can't override the definition of a
macro in a compiled library).  So we had to get a few of the X source
files (the ones we could determine were troublemakers) and recompile
them with the pthreads compiler.

Ideally, I guess you'd want a thread safe libc and X.  According to
the X11R6 release notes, Xlib and Xt are now thread safe if they are
compiled with thread support.  The return value of
XtToolkitThreadInitialize tells you if your Xt has thread support.
This call returns false under Debian.  I guess the question is, could
a Debian linux system actually support this feature, or does it
require waiting for threads in the kernel and a posix threads
interface?

Thanks
--
Rob



Reply to: