Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!pacbell.com!iggy.GW.Vitalink.COM!widener!dsinc!bagate!cbmvax!bj From: bj@cbmvax.commodore.com (Brian Jackson) Newsgroups: comp.sys.amiga.programmer Subject: Re: Window Waiting (was ) Message-ID: <21912@cbmvax.commodore.com> Date: 25 May 91 01:19:58 GMT References: <1991May24.102345.1@wombat.newcastle.edu.au> <1991May24.092943.31027@kuhub.cc.ukans.edu> Reply-To: bj@cbmvax.commodore.com (Brian Jackson) Organization: Commodore, West Chester, PA Lines: 56 In article <1991May24.092943.31027@kuhub.cc.ukans.edu> markv@kuhub.cc.ukans.edu writes: > >There are two solutions. One, if you only wan't to update the display >when your window is active, and if you aren't real picky about >precision, try INTUITICKS messsage. I do this to update a clock >counter, recheck memory, like this: > > while(!QuitFlag) { > WaitPort(MyWindow->UserPort); > while ((MyMsg = GetMsg(MyWindow->UserPort)) != NULL) { > switch(MyMsg->Class) { > case INTUITICK: > if((TickCount++) % 10) == 0) { > DoUpdateStuff(); > } > break; > case CLOSEWINDOW: > QuitFlag = FALSE; > break; > /* ... etc ... */ > } > ReplyMsg(MyMsg); > } > } > >Mark Gooderum The only change that I would make to this is that the ReplyMsg() call should come much sooner. Let Intuition have it's message back asap. ULONG class ; ... while((MyMsg = GetMsg(MyWindow->UserPort)) != NULL) { class = MyMsg->Class ; /* make a local copy */ ReplyMsg(MyMsg) ; /* reply asap */ switch(class) { ... } } If 'DoUpdateStuff()' is large, you hang onto Intuition's message for a long time. If Intuition can't find an existing message to use for the NEXT thing it wants to send to you, it will allocate memory for a new one rather than use one already in existance. Brian ----------------------------------------------------------------------- / Brian Jackson Software Engineer, Commodore-Amiga Inc. GEnie: B.J. \ \ bj@cbmvax.cbm.commodore.com or ...{uunet|rutgers}!cbmvax!bj / / "Anyone considering the purchase of a high-end Macintosh or IBM- \ \ compatible computer should try an Amiga 3000 for a few hours before / / making the final decision." - Consumer Reports ('91 Buying Guide) \ -------------------------------------------------------------------------