Need help with Sunview programming (Notifier doesn't)

Scott Paisley paisley at cme.nbs.gov
Tue Feb 28 18:04:52 AEST 1989


jmb%warwick.uucp at nss.cs.ucl.ac.uk (James M Beckett) writes:
>Changing the button I can do, however the notifier and I seem to be having
>a breakdown of communications: I can't persuade it to let me do anything
>(including resize, move, close etc, let alone select items) while the draw
>routine is doing its work.

I found a solution to this problem, (without doing explicit dispatching)
but I'm sure that this method could be refined quite a bit.  One way
around this problem is to fork the draw routine so that it has it's own
process.  That way you still can move the window, quit, close it or
whatever else you want to do.  Here is a code frag that will do the job.

...
if ((pid = fork()) == -1) {	/* get me another process */
    perror("fork failed");
    exit(-1);
}
if (pid == 0) {		/* this identifies the child process */
    draw_routine();	/* call the draw routine  */
    exit(1);		/* exit the child process */
}
...

Barry Warsaw and I actually tried this piece of code, and it does in fact
work.  However, we noticed that while in the draw routine, the drawing was
somewhat jumpy. BUT you can click on the frame and get the frame menu
while the program draws.  Another method that we haven't tried was to fork
off the window_main_loop call itself and then go about your business.  I
would think that this would yield similar results to the above code.  I
would be interested in hearing from any other solutions that people come
up with.

Scott Paisley        paisley at cme.nbs.gov        ..!uunet!cme-durer!paisley



More information about the Comp.sys.sun mailing list