• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Exclusive File Access
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exclusive File Access


  • Subject: Re: Exclusive File Access
  • From: Malte Tancred <email@hidden>
  • Date: Thu, 21 Nov 2002 13:47:11 +0100

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@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Exclusive File Access (From: mw <email@hidden>)

  • Prev by Date: Re: placing windows behind finder icons
  • Next by Date: Re: Coloring NSBox background?
  • Previous by thread: Re: Exclusive File Access
  • Next by thread: Re: Table View Blues (summary)
  • Index(es):
    • Date
    • Thread