If I have two threads in my Cocoa app, and (let's say), I'm reading from file X on the disk with an NSData +dataWithContentsOfFile:
, and another thread is concurrently updating or replacing that same file X, with, say a -writeToPath:atomically:
?
I'm unfamiliar with what Cocoa's standard file read/writes modes are. Could the read operation see corruption mid-file? If so, what is the standard way around this? Use POSIX functions to allow effectively multiple-readers but only one exclusive writer?
Thanks for insight that bridges my understanding between the Cocoa API and the underlying filesystem.