Re: XForms: Q: xforms in a linux pthread

Tristan Savatier (tristan@mpegtv.com)
Fri, 27 Nov 1998 12:43:36 -0800

# To subscribers of the xforms list from Tristan Savatier <tristan@mpegtv.com> :

Michael Stillger wrote:
>
> # To subscribers of the xforms list from Michael Stillger <stillger@dbis.informatik.hu-berlin.de> :
>
> Hi
> I am trying to port my multi-pthreaded programm to Linux (single CPU system)
> an use xforms for my GUI.
> I am using libc5 and a quite new pthread lib. (its S.U.S.E Jul. 98 distr.)
> The User Interface of my program should run in a separate thread.
> I get an error message saying that the program fails due to XIO errors.
> XIO error 0 (Success)
> receiving x events and exit after some xy attempts
>
> As far as i know linux threads are not threads but
> processes: i.e. you can't debug them and the xforms thread (like any other)
> automatically runs in a kind of bg mode. I am also considering unsing
> the glibc2 implementation if this is what is needed.

no, threads are read threads, but they are system threads, i.e. they use
the same scheduler as processes. But they do share all their data
except stack and PC.

>
> This might be a simple question, but i failed to get it going. (and my linux
> knowledge is also quite limited ;)
> Is it a Linux pthread problem or an xforms problem ?
> Any help is very appreciated.

We have developed multitheaded applications with Linux and
are using xforms.

Here is the situation:

1) it will not be easy to do that with a libc5 system. I strongly
recommand using glibc.

2) If you have libc5, only one thread (the main thread)
can use X, because the Xlib is not thread safe on libc5 systems.
Additionally, there is a bug in the pthread lib
that causes the errno used by non-threaded libraries to be
different from the errno used by the main thread. You should
use the patched version of libpthread available from:
ftp://ftp.mpegtv.com/pub/mpeg/mpegtv/player/x86-unknown-linux/README-libpthread
ftp://ftp.mpegtv.com/pub/mpeg/mpegtv/player/x86-unknown-linux/libpthread-mpegtv.so.0.7.gz

3) If you use glibc (aka libc6):
When using X11 (or any library that uses X11), each thread
must open its own connection with X i.e. each thread must
uses its own "display". several threads can share objects
like windows etc.

good luck!

-t
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/