[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File locking?



Gunnar:
By interdependent, I meant that the data in one file is related to the data
in another file.  I.e., updating one of the files without performing the
corresponding update to another file would result in the files becoming
inconsistent.  I don't know whether this is possible with the Ringlink data
files.
If the above _could_ happen, a way of avoiding it is to lock all related
files
at the same time.
Here's a way of doing that:
open and lock temporary file 'lock.tmp'
open file #1
access file #1
close file #1
open file #2
access file #2
close file #2
close temporary file 'lock.tmp'
As long as files #1 and #2 are always accessed in this manner, they can't
become inconsistent.
I don't understand the Ringlink scripts well enough to analyze them, but I
plan to trying to go through them eventually :)
-----Original Message-----
From: Gunnar Hjalmarsson <mailbox@gunnar.cc>
To: ringlinklist@gunnar.cc <ringlinklist@gunnar.cc>
Date: Saturday, October 14, 2000 3:23 PM
Subject: Re: [ringlinklist] File locking?
>I'm not sure of what you mean exactly by interdependent, but I'd guess
>they are not. Each time a file is opened for writing, all info that will
>be put into it has already been stored in a Perl variable.
>
>But this is an area I don't know very much about; I found "the lock
>model" in another script. So if you have some knowledge about it, I'd
>appreciate if you could take a closer look. For instance, you could
>check the "new site" or "edit site" routine, since sites.db is the file
>which would be most difficult to fix if it got corrupted.
>
>/ Gunnar

Follow-Ups from:
Gunnar Hjalmarsson <mailbox@gunnar.cc>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]