• 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: NSThread or NSTimer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSThread or NSTimer


  • Subject: Re: NSThread or NSTimer
  • From: Shawn Erickson <email@hidden>
  • Date: Tue, 27 Apr 2004 12:42:16 -0700

On Apr 27, 2004, at 12:35 PM, Shawn Erickson wrote:
On Apr 27, 2004, at 11:52 AM, Bob Ippolito wrote:
On Apr 27, 2004, at 2:06 PM, Jesus De Meyer wrote:
I understand that NSThread is usually used with multiple document applications or when you wanna use a second processor.

But for simple applications that just need some kind of update method, what should I use? I ask because I have the impression that NSThread will add better performance than if I use an NSTimer, although I'm not sure if this statement is true.

Again, I'm talking about simple applications that only have need one "update loop", for example to update certain interface elements.

For this kind of task, what's better, NSThread or NSTimer?

In general you shouldn't use threads until you have to, so use NSTimer.

One obvious hint on when you should start to shuttle longer running items off to a thread is when you see the spinning beach ball. This beach ball is telling you that some operation you are doing is holding off the main thread from handling events (user events, etc.) in a timely fashion.

Even before then you should attempt to insure that your UI remains responsive to the user while it is working on things. You can use threads to help insure this and/or by using non-blocking capabilities of APIs/frameworks that you are using (for example NSFileHandle's readInBackgroundAndNofity and friends).

As a side note Apple has a conceptual doc on threading and Cocoa, if it helps at all.

<http://developer.apple.com/documentation/Cocoa/Conceptual/ Multithreading/index.html>

-Shawn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >NSThread or NSTimer (From: Jesus De Meyer <email@hidden>)
 >Re: NSThread or NSTimer (From: Bob Ippolito <email@hidden>)
 >Re: NSThread or NSTimer (From: Shawn Erickson <email@hidden>)

  • Prev by Date: Re: Is Concatenation that complex?
  • Next by Date: Re: NSThread or NSTimer
  • Previous by thread: Re: NSThread or NSTimer
  • Next by thread: Re: NSThread or NSTimer
  • Index(es):
    • Date
    • Thread