Does anyone know if NSArchiver's archive to file methods do atomic
file writes?
___
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
On Mar 29, 2009, at 5:39 AM, Michael Vannorsdel wrote:
Does anyone know if NSArchiver's archive to file methods do atomic
file writes?
Yes - anyone who has read the API documentation for those methods
knows whether or not they write the files atomically.
Jim
On Sun, Mar 29, 2009 at 2:57 PM, Michael Vannorsdel mikev...@gmail.com wrote:
Guess I should clarify. Has anyone verified it; I've had an issue with
partial writes archiving built-in classes. The program used to get signals
to terminate and archive some basic classes (NSArray, NSString,
Guess I should clarify. Has anyone verified it; I've had an issue
with partial writes archiving built-in classes. The program used to
get signals to terminate and archive some basic classes (NSArray,
NSString, NSNumber) to disk. But these files would only contain some
of the archive
Yes no surprise..
But if NSArchiver is indeed atomic I would think the saved file would
either be saved complete with new data or complete old data and not
with partial data in situations like an untimely crash or resource
loss. Unless I have the wrong expectation of atomic file writes,
All bets are off if you do unsupported things inside of a signal
handler. For instance it is possible that the routines used to write
the file *seemed* to complete successfully when they, in fact, didn't.
In which case the code went along its merry way and did the rename.
On Sun, Mar 29, 2009 at
Alright thanks, what I was looking for.
On Mar 29, 2009, at 1:41 PM, Clark Cox wrote:
All bets are off if you do unsupported things inside of a signal
handler. For instance it is possible that the routines used to write
the file *seemed* to complete successfully when they, in fact, didn't.
In
From the docs:
+ (BOOL)archiveRootObject:(id)rootObject toFile:(NSString *)path
... writeToFile:atomically:, using path for the first argument and YES
for the second.
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin