Is HDB locking safe?
Rahul Dhesi
dhesi%cirrusl at oliveb.ATC.olivetti.com
Sat Aug 25 14:40:49 AEST 1990
>I guess creating a second lock file to be held while deleting the first
>would work.
Our in-house software does file locking, to create a lock file L,
like this:
exlock(L);
create L;
exunlock(L);
/* critical section here */
exlock(L);
delete L;
exunlock(L);
The definition of exlock(L) is:
create a lock file called L|lock, looping with sleep(5) several
times if necessary; if creation fails, report a very serious
error and exit process.
The definition of exunlock(L) is:
delete L|lock; if nonexistent or can't be deleted, report
a very serious error and exit process.
Barring a system or process crash during the very brief interval
that L|lock exists, the above scheme is very robust.
--
Rahul Dhesi <dhesi%cirrusl at oliveb.ATC.olivetti.com>
UUCP: oliveb!cirrusl!dhesi
More information about the Comp.unix.wizards
mailing list