Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!uakari.primate.wisc.edu!caen!uwm.edu!linac!att!pacbell.com!tandem!zorch!amiga0!mykes From: mykes@amiga0.SF-Bay.ORG (Mike Schwartz) Newsgroups: comp.sys.amiga.programmer Subject: Re: Window Waiting (was ) Message-ID: Date: 27 May 91 07:28:00 GMT References: <1991May24.102345.1@wombat.newcastle.edu.au> <1991May24.092943.31027@kuhub.cc.ukans.edu> <21912@cbmvax.commodore.com> Organization: Amiga makes it possible Lines: 67 In article <21912@cbmvax.commodore.com> bj@cbmvax.commodore.com (Brian Jackson) writes: >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 > Or even better is to use a structure assignment to copy the entire contents of the message to a private message struct before replying... > ----------------------------------------------------------------------- >/ 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) \ >------------------------------------------------------------------------- -- **************************************************** * I want games that look like Shadow of the Beast * * but play like Leisure Suit Larry. * ****************************************************