On the importance of multithreading in iOS, no nonsense. Just one word: Important! ^_^
Three kinds of multithreading methods commonly used in iOS: Nsthread, GCD, nsopertaion
Although Nsthrea ranked first (almost all the books that introduce multithreading are so sorted), but with the least, reason: No back of the two younger brother with thoughtful.
As a multi-threaded eldest brother, Nsthread almost had to hide behind the scenes.
Nsthread is introduced from Mac OS to iOS, and before Mac OS 10.5, the Nsthread is enabled with only one:detachNewThreadSelector:toTarget:withObject:
After 10.5, Apple added a more minimalistic way to enable it: Start
And after 10.5, inheriting the subclass of the Nsthread, you can override the Main method (one of the thread's entry methods), no longer call Super's Main method;
Learn about Nsthrea outline:
1. Initialization
-(ID) init
This method is designed to initialize an instance,
-(ID) Initwithtarget: (ID) Target selector: (SEL) Selector object: (ID) argument
Target: The object used to receive the message selector (in other words, the Select method that invokes target);
Selector: Message sent to target, (Target's selector method), this message can only have one parameter, and cannot have the return value;
Argument: An object passed to target, which can be nil;
Garbage collection mechanism has been a problem of Apple development, has been a long time iOS will also be considered OC is not garbage collection, in fact, this statement is not entirely correct; strictly speaking, OC under iOS is not garbage collected, under the Mac, OC has garbage collection mechanism;
In the absence of a garbage collection mechanism, the Selector method maintains an auto-free pool and puts the target and argument into the auto-release pool, releasing the auto-release pool when the thread exits;
In the case of a garbage collection mechanism, this automatic release pool will not be produced;
/***************************** Follow-up trailer ******************************
2. Use (START process/stop process/...)
3. Status query processing (whether main main thread/whether multi-threaded/Set priority/...)
4. Notifications (three notification messages)
***********************************************************************/