| 1. |
What Mechanisms Does Ios Provide To Support Multi-threading? |
|
Answer» NSThread creates a new low-level thread which can be started by calling the start method. NSThread* myThread = [[NSThread alloc] initWithTarget:self NSOperationQueue allows a pool of threads to be created and used to execute NSOperations in parallel. NSOperations can also be run on the main thread by asking NSOperationQueue for the mainQueue. NSOperationQueue* myQueue = [[NSOperationQueue alloc] init]; GCD or Grand Central Dispatch is a modern FEATURE of Objective-C that provides a rich set of METHODS and API's to use in order to support common multi-threading tasks. GCD provides a way to QUEUE tasks for dispatch on either the main thread, a concurrent queue (tasks are run in parallel) or a serial queue (tasks are run in FIFO order). dispatch_queue_t myQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); NSThread creates a new low-level thread which can be started by calling the start method. NSThread* myThread = [[NSThread alloc] initWithTarget:self NSOperationQueue allows a pool of threads to be created and used to execute NSOperations in parallel. NSOperations can also be run on the main thread by asking NSOperationQueue for the mainQueue. NSOperationQueue* myQueue = [[NSOperationQueue alloc] init]; GCD or Grand Central Dispatch is a modern feature of Objective-C that provides a rich set of methods and API's to use in order to support common multi-threading tasks. GCD provides a way to queue tasks for dispatch on either the main thread, a concurrent queue (tasks are run in parallel) or a serial queue (tasks are run in FIFO order). dispatch_queue_t myQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); |
|