Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!ames!indri!dogie.macc.wisc.edu!csd4.milw.wisc.edu!bbn!mit-eddie!uw-beaver!rice!sun-spots-request From: weiser.pa@xerox.com Newsgroups: comp.sys.sun Subject: Re: Notifier question Keywords: Windows Message-ID: <3749@kalliope.rice.edu> Date: 8 Jun 89 01:10:42 GMT Sender: usenet@rice.edu Organization: Sun-Spots Lines: 21 Approved: Sun-Spots@rice.edu X-Sun-Spots-Digest: Volume 8, Issue 22, message 1 of 10 It is a frequent question: "How do I "poll" the nofier while I am in a tight processing loop?" Calling "notify_dispatch()" in the loop does not work. I use the following routine to force the poll, called "window_update". Its a kludge, but it works, because the notifier has to take control around I/O calls, so this gets it a chance to get in and handle some buttons, screen refreshes, signals, whatever. Stick a call to "window_update()" in your tight loop... (but not too often: "select" is expensive.) window_update() { int width = 0; fd_set readfds, writefds, exceptfds; struct timeval real_timeout; FD_ZERO(&writefds); FD_ZERO(&readfds); FD_ZERO(&exceptfds); real_timeout.tv_sec = 0; real_timeout.tv_usec = 0; select(width, &readfds, &writefds, &exceptfds, &real_timeout); }