> On Sep 12, 2014, at 12:16 AM, Daryle Walker <[email protected]> wrote: > > I heard that the User Defaults API does caching since 10.9 Mavericks. If so, > it is safe to use when adding Sudden Termination to your app?
It's Apple's code so I assume they would make it safe with Sudden Termination. My guess is that NSUserDefaults sends changes to a central agent process that manages the caching and flushing. > I figure that Sudden Termination should be suspended when running save-file > code, to avoid corruption. Only if the save code is asynchronous with respect to the main runloop. AFAIK, sudden termination is only invoked when the main runloop handles an event — either a user Quit command, a 'quit' AppleEvent, or some other IPC message requesting a quit. So if your save code runs on the main event loop (or in a synchronous call triggered from the main thread) it can't be interrupted. > Should it also be done for load-file code? What about when a local file URL > is loaded into a WebKit instance? I don't think so. If loading a file doesn't change any persistent state, there shouldn't be a problem if your app is terminated in the middle of it. —Jens _______________________________________________ Cocoa-dev mailing list ([email protected]) 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 [email protected]
