Tutorial by Examples

The most simple way to create a thread is by calling a selector "in the background". This means a new thread is created to execute the selector. The receiving object can be any object, not just self, but it needs to respond to the given selector. - (void)createThread { [self performS...
Using a subclass of NSThread allows implementation of more complex threads (for example, to allow passing more arguments or to encapsulate all related helper methods in one class). Additionally, the NSThread instance can be saved in a property or variable and can be queried about its current state ...
Every thread has access to a mutable dictionary that is local to the current thread. This allows to cache informations in an easy way without the need for locking, as each thread has its own dedicated mutable dictionary: NSMutableDictionary *localStorage = [NSThread currentThread].threadDictionary;...

Page 1 of 1