|
There is another solution to the problem of long call backs that may be less
expensive than another process. Use a timer-ast to drain the X event queue to
a lookaside list. Then replace the traditional mainloop with code which looks
something like:
while(1) {
if (lookaside != &lookaside)
remove_queue(lookaside,event); /* remove_queue is a jacket macro for REMQUE */
else
XtNextEvent(&event);
XtDispatch(event);
}
The overhead of a timer is much less than that of the interprocess communication
the second process.
The layered products which I am aware of use a timer which is in the 50 to 100
millisecond range, although you may get acceptable results with a larger time
value.
James
|
| However, if you use the timer AST mechanism described in .2, you get the
obnoxious and disgusting behavior of so many of our DECwindows applications
(DW MAIL, DW NOTES, and DW LSE, for example), where they don't process any
events (such as expose events) while they're off doing a long callback.
The timer AST stuff that .2 talks about hacks around the problem of the
server disconnecting misbehaving applications, but it doesn't solve the
real problem, which is that the applications are not doing timely event
processing like they're supposed to.
I recommend the multiprocess approach until we get multithread support, when
you can have one thread dedicated solely to dispatching X events (you can do
this in Ada now, BTW).
--PSW
|