• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cocoa Open GL help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa Open GL help


  • Subject: Re: Cocoa Open GL help
  • From: Ondra Cada <email@hidden>
  • Date: Thu, 13 Sep 2001 11:01:56 +0200

Brent,

>>>>>> Brent Gulanowski (BG) wrote at Wed, 12 Sep 2001 19:55:04 -0400:
BG> [self performSelector: _cmd withObject: nil afterDelay: (elapsedTaskTime
BG> - idealWaitTime)]
BG>
BG> which seems to be working wonderfully, but I noticed that the Teapot
BG> application uses NSTimers added to the RunLoop. I guess that the latter
BG> is more civilized, but is there any danger with the former?

There is not. Actually, so far as I know, it is just another API for the
very same implementation.

BG> It's another
BG> place where I can use a flag to stop it, but all of these boolean flags
BG> seem... clumsy for Cocoa apps. I like the idea that messaging should do
BG> all the if-else work for me. Guess that doesn't apply within an
BG> implementation tho.

I'm afraid I dont quite understand. The performSelector... API is best if
the behaviour is self-contained, so that (among others) it _itself_ "knows"
when to stop; if so, you don't need flags:

-(void)method {
...
if (any_local_test_which_shows_whether_to_continue)
[self performSelector:_cmd withObject:nil afterDelay:delay];
...
}

If you are controlling the "idle loop" externally, NSTimer seems to be a
nicer API, and you can stop it (by sending it invalidate) from anywhere...
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc


References: 
 >Re: Cocoa Open GL help (From: Brent Gulanowski <email@hidden>)

  • Prev by Date: Re: an interesting delegate design issue raised by IB...
  • Next by Date: Re: Applications folder path
  • Previous by thread: Re: Cocoa Open GL help
  • Next by thread: Re: Cocoa Open GL help
  • Index(es):
    • Date
    • Thread