Monday, January 12, 2009 [Tweets] [Favorites]

Mac OS X Thread Safety

Mike Ash:

This is all fine and dandy except that Apple, in their infinite wisdom, does not always distinguish between main thread only and not thread safe. To make things worse, they even sometimes use the term thread safe to mean what we have defined here as not thread safe.

The post has good examples of the different kinds of thread safety in Mac OS X and how Apple describes (or neglects to describe) them. However, contra Ash, I think the documentation really is trying to convey that Search Kit is thread-safe. The full text from the reference page says:

Search Kit is thread-safe. You can use separate indexing and searching threads. Your application is responsible for ensuring that no more than one process is open at a time for writing to an index.

This implies that you can have multiple threads reading and writing, and in my experience this does work. It also points to a fourth category of thread-safety: how the API handles multiple threads or multiple processes creating separate objects that reference the same shared file or other resource.


Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment