home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!sun-barr!apple!apple!NewsWatcher!user
- From: dowdy@apple.com (Tom Dowdy)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: How do I sleep w/o using any CPU time
- Message-ID: <dowdy-200792081218@90.10.20.25>
- Date: 20 Jul 92 15:15:13 GMT
- References: <0105011F.8acslo@dragon.enigami.mv.com> <1992Jul13.150027.4926@usenet.ins.cwru.edu>
- Sender: usenet@Apple.COM
- Followup-To: comp.sys.mac.programmer
- Organization: Apple Computer, Inc.
- Lines: 39
-
- In article <1992Jul13.150027.4926@usenet.ins.cwru.edu>, yjc@po.cwru.edu
- (Jerome Chan) wrote:
- >
- > In article <0105011F.8acslo@dragon.enigami.mv.com> Cory Kempf,
- > cory@enigami.mv.com writes:
- > >The way to give up the CPU is to call WaitNextEvent, passing it a
- > >large number of the 3rd parameter (time that WNE can give away).
- > >I usually use 50 or so (there was this bug a while back...). By putting
- > >this inside a while loop that checks the tickcount, I give away as
- > >much CPU as I can.
- >
- > Hmm. But won't we be losing events if we do this? If windows are being
- > displayed and the user switches to another application under
- > multi-finder, won't we lose the the Update Event? Or is that the
- > Resume/Suspend Event?
-
- Actually, you won't be losing events - however, there is a potential
- serious
- problem with calling WNE this way all of the time. Note that in *this*
- particular case, the original poster (long since gone from this discussion,
- I would fear) wasn't going to have any windows open - he was simply running
- until an event happened, at which time a dialog box would be brought
- up (no doubt saying something such as "Your rendering is complete").
-
- However, if you *do* have windows open, and fail to respond to update
- events, you will see very sluggish performance on your Mac as the
- process manager attempts to give you updateEvents over and over again.
- Eventually, when it sees some very large number of update events go
- by for the same window, it will assume you are clueless and clear
- the updateRgn itself - however, this takes almost a minute and a half.
-
- The thing to learn is - always handle update events, and always call
- BeginUpdate()/EndUpdate() when handling them.
-
- Tom Dowdy Internet: dowdy@apple.COM
- Apple Computer MS:81KS UUCP: {sun,voder,amdahl,decwrl}!apple!dowdy
- 20525 Mariani Ave AppleLink: DOWDY1
- Cupertino, CA 95014
- "The 'Ooh-Ah' Bird is so called because it lays square eggs."
-