Thread safety should be explicitly mentioned in every classes' API documentation

Originator:ddribin
Number:rdar://6522412 Date Originated:23-Jan-2009 02:52 PM
Status:Duplicate/4596570 Resolved:
Product:Developer Tools Product Version:Xcode 3.1.1
Classification:Other Bug Reproducible:N/A
 
Summary: 
Background threads are used on Mac OS X not only for CPU intensive tasks, but also to offload tasks from the main thread in order to keep it responsive.  Slow tasks done on the main thread can cause the application to SPOD.  Appendix A of the Threaded Programming Guide lists the thread safety of various classes in Foundation and AppKit.  It would be much more convenient to put this information inside the class API documentation directly.

Furthermore, Appendix A does not cover many other Cocoa classes and frameworks.  Some examples that come to mind are, such as PubSub and NSSpeechSynthesizer.  It would be extremely helpful if each and every class included a section about it's thread safety.  At the least, it should state if the class is thread-safe, thread-unsafe, or main-thread only.

As features like NSOperation and the upcoming Grand Central are used to make Cocoa applications more asynchronous, this information becomes ever more important.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!