On Feb 25, 2017, at 14:58 , Daryle Walker <dary...@mac.com> wrote:
> 
> I thought the entire AppKit, which includes NSDocument, runs only on the main 
> thread. The exceptions are methods that specially state that they have a 
> multi-threaded mode.

Much stuff in AppKit must be called on the main thread, yes, and anything that 
affect the UI presentation we assume to require the main thread. And yes, many 
more recent APIs have a background-thread operational mode for (usually) parts 
of a larger functional process. However, there’s a third category, of stuff 
that does not apparently have any thread requirements beyond the basic need for 
thread safety of mutable data references.

The fact that the documentation for this save method explicitly states the need 
to invoke the completion handler on the main thread is a hint that the save 
method might be in this third category — not have any thread-related 
requirements of its own.

In addition, since it’s so easy to invoke a handler on the main thread, I’d say 
it’s safer to do so, than to rely on an assumption, however plausible.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to