XtAppAddTimeOut() registers a timer procedure that is called after a specified amount of time. Xt's main event
processing loop takes care of calling the timer routine after the appropriate time interval. Since we have specified an
interval of 0 for the reset_btn() timer, the routine is called immediately after the signal is received and control is
passed back to the main event loop. The reset_btn() routine handles restoring the state of the DrawnButton, so
that the user can run the associated application again.
In terms of signal handling, there is really one main difference between using a work procedure and using an interval
timer. The work procedure is called as soon as the application is idle and waiting for input, while the timer is called
after a specified interval.
21.4 Additional Issues
There are several loose ends that we need to address. One issue involves the way timers are implemented. You may be
thinking, "Isn't a timer another signal in UNIX?" While the answer is yes, what is important is that Xt−timers are not
implemented using UNIX signals, but instead using a feature of the select() system call. In this context,
select() is used to determine if the X server is sending events to the application (although this function does not
actually read any events). The last parameter to select() is a time interval that specifies how long the routine waits
before returning whether there is anything to read. Setting this time interval allows Xt to implement what appears to
be a timer. As ...