Brief introduction
Threading is a technique that can execute multiple code paths in one application at the same time. While new technologies such as operands and GCD provide a more modern and efficient tool for concurrency,OS X and iOS also provide interfaces to create and manage threads.
This article reveals the thread packs available in OS X and shows how to use them. This article also describes techniques for supporting threading and multithreaded code synchronization in an application.
Important: If you are developing a new application, you are encouraged to study the implementation of concurrent OS X technology. In particular, you are not familiar with the design techniques required to implement threading applications. These alternative technologies simplify your effort to implement concurrent paths and provide better performance than traditional threads. For information on these technologies, see the Concurrent Programming Guide (Concurrency Programmingguides).
Organizational structure of this article
This article has the following chapters and appendices:
About threading programming (aboutthreaded programming ) introduces the concepts of threading and their role in application design.
ThreadManagement provides threading technology information in OS X and how to use them.
Running a loop (runLoops ) provides information on how to manage the event-handling loops in a secondary thread.
Synchronization (synchronization ) describes synchronization issues and tools that you can use to prevent data corruption and application crashes that are caused by multiple threads.
Thread Safety Summary (threadsSafety Summary ) provides a high-level summary of inline security and their key frameworks.
See Also
For information about threading overrides, see the Concurrency Programming Guide (Concurrency programmingguides).
This document provides a simple summary of the use of the POSIX threading API . For more information on POSIX threading, see pthread . For more on POSIX threading and more in-depth explanations, see the POSIX threading programming of David R. Butenhof (programming with POSIX Threads).
Official Original address:
Https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/Multithreading/Introduction/Introduction.html
Document Revision History
This table describes the changes to the Threading Programming Guide (This table describes the changes to threading programming).
Date |
Description |
2014-07-15 |
Remove Nsxmldocument from the thread-safe class list |
2013-10-22 |
Adding Nsxmlparser and nsxmldocument to the list of thread-safe objects |
2013-08-08 |
Delete obsolete information |
2010-04-28 |
Correcting spelling errors |
2009-05-22 |
About the Operation object information is transferred to the Concurrency Programming Guide (Concurrency programming Guides). This article re-concentrates to threads |
2008-10-15 |
Example code for updating an Action object and an action queue |
2008-03-21 |
IOS Update |
2008-02-08 |
Big changes and updated thread-related concepts and tasks |
|
Add more about thread configuration information |
|
The Reorganization Synchronization Tool section is a chapter and adds information about atomic operations, memory barriers, and unstable variables |
|
Add more details about the usage and configuration of the run loop |
|
Change the document title to multithreaded programming topics |
2007-10-31 |
To add information about nsoperation and Nsoperationqueue objects |
2006-04-04 |
Add some new until and update the run loop information. Verify the Distributed object Sample code accuracy and update the sample code for the other articles. |
2005-03-03 |
Update the port example using Nsport instead of Nsmessageport. |
2005-01-11 |
Reorganizing articles and extending document coverage not only includes cocoa threading technology. |
|
Update the thread conceptual information and add information about the different thread packages in OS X. |
|
Merge materials from the core Foundation multi-threaded (Core foundation multithreading) documentation. |
|
Adds information about the execution of socket-based communication between threads. |
|
Add sample code and information about creating and using carbon threads. |
|
Add the Thread safety Guide. |
|
Adds information about POSIX threads and locks. |
|
Add sample code that demonstrates port-based communication. |
|
This document supersedes the thread information in previously published multithreading (multithreading). |
2003-07-28 |
Update recommendations for using third-party class library locks |
2003-04-08 |
Reiterate information about locking/unlocking in third - party class libraries |
2002-11-12 |
Add a revision history to an existing theme |
Official Original address:
https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/Multithreading/RevisionHistory.html#// Apple_ref/doc/uid/20001609-cjbgiagf
Threading Programming Guidelines (Threading Programming Guide)