mms@crdgw1.ge.com (Mark Scoville) (06/19/91)
I am attempting EXPLICIT DISPATCHING, and am failing sorely! After invoking the application, I toggle back and forth about 3 times or so between 'Start Loop' and 'STOP'. At some point it hangs on STOP. ================================= SPARCstation 1/2 SunOS 4.0.3/4.1 XView 2.0 DevGuide 1.1 OW 2.0 ================================= Thanks in advance. ********************************************** * Mark Scoville (415) 683-4332 * * mms@nmri.ge.com -OR- ...!sane!genmri!mms * ********************************************** ---------------------------- code fragment ------------------------- int flag = FALSE, looper = 0; Display *dpy; void main(argc, argv) int argc; char **argv; { ntf_window1_objects *ntf_window1; /* Initialize XView. */ xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, 0); INSTANCE = xv_unique_key(); /* Initialize user interface components. */ ntf_window1 = ntf_window1_objects_initialize(NULL, NULL); dpy = (Display *)xv_get(ntf_window1->window1, XV_DISPLAY); xv_set(ntf_window1->window1, XV_SHOW, TRUE, NULL); XFlush(dpy); /* Turn control over to XView. */ while(looper < 1000) { notify_dispatch(); XFlush(dpy); LoopFct(ntf_window1); } exit(0); } /* Notify callback function for `button1'. */ void FctDoLoop(item, event) Panel_item item; Event *event; { ntf_window1_objects *ip = (ntf_window1_objects *) xv_get(item, XV_KEY_DATA, INSTANCE); switch (flag) { case FALSE: xv_set(ip->button1, PANEL_LABEL_STRING, "STOP", NULL); flag = TRUE; notify_stop(); break; case TRUE: xv_set(ip->button1, PANEL_LABEL_STRING, "Start Loop", NULL); flag = FALSE; break; } } LoopFct(ip) ntf_window1_objects *ip; { char val[20]; while (flag) { notify_dispatch(); XFlush(dpy); sprintf(val, "%d", looper++); xv_set(ip->textfield1, PANEL_VALUE, val, NULL); } return(0); } ------------------------------ end code fragment -----------------------------