Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!rutgers!cbmvax!bj From: bj@cbmvax.commodore.com (Brian Jackson) Newsgroups: comp.sys.amiga.programmer Subject: Re: Window Waiting (was ) Message-ID: <21943@cbmvax.commodore.com> Date: 27 May 91 19:19:00 GMT References: <1991May24.102345.1@wombat.newcastle.edu.au> <1991May24.092943.31027@kuhub.cc.ukans.edu> <21912@cbmvax.commodore.com> Reply-To: bj@cbmvax.commodore.com (Brian Jackson) Organization: Commodore, West Chester, PA Lines: 34 In article mykes@amiga0.SF-Bay.ORG (Mike Schwartz) writes: >In article <21912@cbmvax.commodore.com> bj@cbmvax.commodore.com (Brian Jackson) writes: >>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. >> >> 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. >> >Or even better is to use a structure assignment to copy the entire contents >of the message to a private message struct before replying... It's only 'better' if you need the contents of the entire message. If my program only needs, say, the Class and Code fields of an IntuiMessage then what purpose (other than to slow things down) is served by copying the entire 56 bytes of the IntuiMessage every time rather than simply extracting the 6 bytes that I need ? Brian ----------------------------------------------------------------------- | Brian Jackson Software Engineer, Commodore-Amiga Inc. GEnie: B.J. | | bj@cbmvax.cbm.commodore.com or ...{uunet|rutgers}!cbmvax!bj | | "We defy augury" | -----------------------------------------------------------------------