Thread-local storage
suggest changeEvery thread has a mutable dictionary local to that thread. You can cache information there without locking, because each thread has its own dictionary:
NSMutableDictionary *localStorage = [NSThread currentThread].threadDictionary;
localStorage[someKey] = someValue;
The dictionary is automatically released when the thread terminates.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents