Need help with Sunview programming (Notifier doesn't)

Steven Bickel bickel at nprdc.navy.mil
Wed Mar 1 22:12:23 AEST 1989


jmb%warwick.uucp at nss.cs.ucl.ac.uk (James M Beckett) writes:
>...I want to have the 'plot' button change to
>a 'stop' button, which I can select to stop the fractal while it's drawing
>if it doesn't look too good....
>My theory at the moment is that once a function has been called via the
>notifier, other events are disabled until the function ends.

True.

Have the panels notify proc call notify_set_itimer_func(). Below is a
routine that can act as a nice interface to notify_set_itimer_func().
notify_set_itimer_func() will have the system clock (via signal - don't
use this unix function with notify_set_itimer_func()) call the designated
routine and all panel buttons within your frame will still be active.
These button will be capable of settings flags for stopping your routine.
Also, your routine should immediately reset notify_set_itimer_func() with
no function so that your function is not repeated.  This type of procedure
should also be used for panel buttons that destroy their own panel. ( I
modified this code after extracting it from our application, it may need
some slight modifications ie. for resetting the timer_func to NULL - I did
not test it).


/*--  v1.0 
     set_the_notify_itimer: 

     Sets the systems interrupt routine (layer above unix signal() )
     to call the timer node functions update function.

     Returns:  void
*/

void  set_the_notify_itimer(timer_func)
void   (*timer_func) ();

{
/*    ----- Variables -----		*/
    static char *me = (char *) &me;
    struct itimerval timer;
    float update_interval = 0.005; /* minimal time between repeated calls */

/** BEGIN set_the_notify_itimer     */

    /** set the tim interval structure to pass to the system timer interrupt */
    timer.it_interval.tv_usec = (int) (1000000 *
		    (update_interval - (float) ((int) update_interval)));
    timer.it_interval.tv_sec = (int) update_interval;
    timer.it_interval.tv_sec = 0;
    timer.it_value.tv_usec = 1;
    timer.it_value.tv_sec = 0;

    /** set the system timer interrupt routine to be the routine passed in */
    notify_set_itimer_func(me, timer_func, ITIMER_REAL, &timer, NULL);

/** END   set_the_notify_itimer     */
}

          Steve Bickel                          bickel at nprdc.arpa
	  Systems Engineering Assoc.            (619) 553-9306
	  Naval Personel R & D Center.



More information about the Comp.sys.sun mailing list