[comp.windows.x] Is X11R3 re-entrant?

mazer@bek-owl.caltech.edu (Jamie Mazer) (07/22/90)

Yet another novice X question :-(

Can anyone tell me how reentrant the code in R3 is? In particular,
what I'm trying to find out is "how safe it is to use Xt and Xlib
calls from inside a signal handler (namely SIGALRM - alarm (2))?"
My application uses Xaw to set up an interactive control pannel and
then periodically goes off, does some work and then updates output
windows (which contain widgets) and so forth. This "going off" is
triggered by a SIGALRM. So far I haven't had any problems making
toolkit calls from within the handler, but a friend suggested this
might be a dangerous thing to do.

Anybody care to comment on this issue? Please reply to me, I'll
summarize to the net if there's enough/any interest.

Thanks a lot
/Jamie
/  mazer@bek-owl.caltech.edu \
\ jmazer@caltech.bitnet      /

mouse@LARRY.MCRCIM.MCGILL.EDU (der Mouse) (07/23/90)

> Can anyone tell me how reentrant the code in R3 is?

The stuff from MIT, run on anything approximating a typical UNIX
system, not very.

> In particular, what I'm trying to find out is "how safe it is to use
> Xt and Xlib calls from inside a signal handler (namely SIGALRM -
> alarm (2))?"

Xlib should be OK provided you use a separate connection to the
display.  Xt would be too, except that Xt does not behave well in the
presence of two connections in the same program (or so I understand).
If you use the same connection in the main line and at signal-handler
level, eventually a signal will interrupt a main-line call at a
critical time and you'll get burned.

> My application uses Xaw to set up an interactive control pannel and
> then periodically goes off, does some work and then updates output
> windows (which contain widgets) and so forth.  This "going off" is
> triggered by a SIGALRM.  So far I haven't had any problems making
> toolkit calls from within the handler, but a friend suggested this
> might be a dangerous thing to do.

You make it sound as though the main-line is not doing any X
interaction when the signal happens.  If you can guarantee this, you
should be OK.  If this is not true, well, read my paragraph above....

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu