Article View: comp.os.msdos.programmer
Article #1795Re: Implementation of File Locking
From: Christopher D. Brown
Date: Mon, 06 Aug 1990 13:13
Date: Mon, 06 Aug 1990 13:13
28 lines
1725 bytes
1725 bytes
In article <1990Aug3.182050.8793@ns.network.com> dmb@ns.network.com (Duane M. Butler) writes:
[preamble deleted]
>One idea I'm thinking about is to create a temporary lock file in the directory
>where the files are. Each time my program accesses the files in the directory,
>it first checks for the existence of this lock file. If present, it will try
>again in 10 seconds or so, and give up after 3 trys. When the program attempts
>to modify the control files, an attempt is made to create a lock file. What I
>don't know is if the create file operation is atomic. In other words, is it
>possible that two instances of the program could believe they created the lock
>file at the same time?
>
>If anyone has solved this problem I would appreciate hearing from you.
PVCS, built by Polytron now from Sage, uses directory creation rather
than file creation to implement semiphors. I do not know if they had
a reason or viewed the choice as arbitary.
BTW. As much as I feel that available standards (e.g. MS-DOS locking
via SHARE) ought to be used, in this case your choice is the only
one that yields reliable coverage of a wide variety of environments.
cb
--
Christopher D. Brown
Digital: {uunet|texbell|cs.utexas.edu}!execu!cb
Analog: (512) 327-7070
Physical: Execucom, 108 Wild Basin Road, Two Wild Basin, Austin, TX 78764
Technical Details
Message-ID:
<22586@sequoia.execu.com>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!execu!sequoia!cbReferences:
<1990Aug3.182050.8793@ns.network.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!execu!sequoia!cb From: cb@sequoia.execu.com (Christopher D. Brown) Newsgroups: comp.os.msdos.programmer Subject: Re: Implementation of File Locking Message-ID: <22586@sequoia.execu.com> Date: 6 Aug 90 13:13:52 GMT References: <1990Aug3.182050.8793@ns.network.com> Organization: Execucom Systems Corp. Lines: 28