gnu-arch-users
[Top][All Lists]
Advanced

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

[Gnu-arch-users] Re: [BUG] FEATURE PLANS: revlib locking


From: Robin Farine
Subject: [Gnu-arch-users] Re: [BUG] FEATURE PLANS: revlib locking
Date: Fri, 4 Jun 2004 22:20:58 +0200
User-agent: KMail/1.6.2

On Friday 04 June 2004 20.56, Jan Hudec wrote:

> On Fri, Jun 04, 2004 at 15:41:13 +0100, Andrew Suffield wrote:

[...]

> > If the link succeeds and the link count on the lock file is 2,
> > you have the lock. Otherwise you missed: delete the lock file
> > and your temporary file, wait a random interval, and try again.

I would say this is wrong.

> Still the same.

No, if one cared about the success of the link operation, then one 
would not need a temporary file. The successfull creation of a hard 
link to a well-known existing file would suffice to acquire the 
lock. And if the result of the link operation is not reliable, then 
testing the link count of the lock file does not help at all.

What Julian initially proposed was to consider the link count of the 
_temporary file_ which being 2 implies that the link operation 
succeeded. This assumes that one can ensure name uniqueness.

Also, when the lock attempt fails, only the temporary file should be 
removed, not the lock file.


Robin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]