Skip navigation.
 
mlRe: Exclusive File Access
FROM : Malte Tancred
DATE : Thu Nov 21 13:47:11 2002

On thursday, nov 21, 2002, at 12:28 Europe/Stockholm, mw wrote:
> Here's my idea. Let's say that Person A opens a file (that is all well
> and
> simple, right?), and Person B opens the same file at about the same
> time
> (doesn't really matter). Person A makes some changes. The program
> checks
> either the modification date of the file, or some other
> "change-tracker"
> (such as an MD5 hash, which I believe was suggested previously). It
> sees
> that the file hasn't changed, so it does a normal save (overwriting the
> original file with the new information). Now, let's say that Person B
> makes
> some changes to a completely different part of the file. When he
> saves, the
> program performs the same check, and finds that there have been
> modifications to the file between the time it was opened by Person B
> and the
> current save. So The program reads the whole file into memory. Now, we
> have
> 2 copies of the file in RAM, the original one (modified by Person A,
> though), and the one modified by Person B. So the program starts the
> process
> of comparing the elements of 2 file contents in RAM, and then writes
> the
> verified changes back to file.


What happens if Person C beats Person B to it, before Person B's
program is finished comparing the version saved by Person A with Person
B's own version?

Concurrent versioning is a difficult problem to solve. There are tools
dedicated to handle these situations. Use these tools and keep your own
programs simple.

Cheerio,
Malte
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlExclusive File Access Donald Brown Nov 19, 20:38
mlRe: Exclusive File Access Ondra Cada Nov 20, 14:36
mlRe: Exclusive File Access Cameron Hayne Nov 20, 17:08
mlRe: Exclusive File Access Donald Brown Nov 20, 20:49
mlRe: Exclusive File Access Rosyna Nov 20, 22:00
mlRe: Exclusive File Access Ondra Cada Nov 20, 22:19
mlRe: Exclusive File Access Rosyna Nov 20, 23:25
mlRe: Exclusive File Access Michael Norris Nov 21, 00:21
mlRe: Exclusive File Access Ondra Cada Nov 21, 00:29
mlRe: Exclusive File Access Rosyna Nov 21, 00:31
mlRe: Exclusive File Access Ondra Cada Nov 21, 00:32
mlRe: Exclusive File Access Malte Tancred Nov 21, 12:07
mlRe: Exclusive File Access mw Nov 21, 12:28
mlRe: Exclusive File Access Malte Tancred Nov 21, 13:47
mlRe: Exclusive File Access Ondra Cada Nov 21, 14:54