Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
can it be used to run a appl for running in background ?

No. A thread is still part of your process which is suspended when you go into the background.

what exactly for NSThread support is there ?

See the NSThread documentation.


any typical scenario where it is benefitial ?
Any scenario you would normally use a thread: typically when you have a long running task you wish to perform without freezing your apps UI.

And before you ask: no I won't provide any sample code.
 
Thanks I wont ask for code, but I used to do those long running tasks in a asynchronous timer. Was wondering what other benefit NSThread will provide than an asynchronous NStimer would not !
 
Thanks I wont ask for code, but I used to do those long running tasks in a asynchronous timer. Was wondering what other benefit NSThread will provide than an asynchronous NStimer would not !

Normally NSTimers are scheduled on the main NSRunloop. So you could potentially slow down or even block event processing resulting in the UI stuttering or even freezing completely...
 
Thanks I wont ask for code, but I used to do those long running tasks in a asynchronous timer. Was wondering what other benefit NSThread will provide than an asynchronous NStimer would not !

With an async timer, you need to chop up the long running routine yourself into short chunks (timewise), or you'll block the UI.

With a background thread, you can have the routine run continuously (for hours, e.g. until the battery runs out), but the OS will chop it up for you to give (uniprocessor on the iPhone) CPU time to the main run loop and UI events.

It's pretty much a matter of who controls the chopping up, and the priorities between the chopped up chunks of code.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.