[comp.windows.x] How to handle non-X events

Rick.Kazman@SEI.CMU.EDU (06/15/89)

I have an application which needs to communicate to X (which it does through
XtMainLoop) and another independent process.  Currently, we are doing this
by polling first X and then the other process.  This busy-wait has been
identified as a performance bottleneck in our system, however, and we would
like to remove it.  

Is there any way of integrating non-X events into the X event mechanism,
either through Xlib or the toolkit?  Ideally, we would like to be able to
have something like XtAddEventHandler--that is, we would like to be able to
say, upon seeing event A, call routine B.  

Any ideas?  My apologies if this has been discussed already.

Thanks.  rick

klee@gilroy.pa.dec.com (Ken Lee) (06/15/89)

In article <8906142114.AA29150@ew.sei.cmu.edu>, Rick.Kazman@SEI.CMU.EDU writes:
> Is there any way of integrating non-X events into the X event mechanism,
> either through Xlib or the toolkit?

What kinds of events are you looking for?  XtAppAddInput (section 7.1.1) handles file descriptor events.  Unfortunately, signals are currently not well handled by Xt.

Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee@decwrl.dec.com
Uucp: uunet!decwrl!klee

thp@WESTHAWK.UUCP (06/15/89)

You don't say how the independant process communicates. If it
talks via a file (or pipe or socket) the you can just say:

XtAddInput(fdesc, XtInputReadMask, stalk_readln, &fdesc);

where fdesc is the file you are interested in and stalk_readln() is a
function you want invoked when data arrives on fdesc . This has worked
very well for me.

If however you communicate via signals, shared memory, semaphores etc
then it's harder, X betraying it's BSD roots ?

Tim.
+----------------------------------------------------------------------------+
|Tim Panton, Westhawk Ltd.       (Contract X application programmer)         |
|Paper: Westhawk Ltd. 26 Rydal Grove, Helsby, Cheshire, WA6 OET. UK.         |
|Phone: +44 92822574             uucp : ..!mcvax!ukc!cam-cl!westhawk!thp     |
+----------------------------------------------------------------------------+