Thread-Safe Classes and Functions
The following classes and functions are generally considered to be thread-safe. You can use the same instance from multiple threads without first acquiring a lock.
-
NSDecimal
functions -
Object allocation and retain count functions
-
Zone and memory functions
Thread-Unsafe Classes
The following classes and functions are generally not thread-safe. In most cases, you can use these classes from any thread as long as you use them from only one thread at a time. Check the class documentation for additional details.
-
NSHashTable
functions -
NSMapTable
functions -
User name and home directory functions
Note that although NSArchiver
, NSCoder
, and NSEnumerator
objects are themselves thread-safe, they are listed here because it is not safe to change the data objects wrapped by them while they are in use. For example, in the case of an archiver, it is not safe to change the object graph being archived. For an enumerator, it is not safe for any thread to change the enumerated collection.
Main Thread Only Classes
The following class must be used only from the main thread of an application.