robust locking

Conor P. Cahill cpcahil at virtech.uucp
Wed Aug 29 22:21:52 AEST 1990


In article <2320 at cirrusl.UUCP> dhesi%cirrusl at oliveb.ATC.olivetti.com (Rahul Dhesi) writes:
>A very simple mechanism can be used to ensure that such race conditions
>don't occur. Create a lock file that contains both process id and host
>name.  If a second process wants to create the same lock, it checks any
>existing lock file.  If the lock file exists, and the host name in it
>is that of the current host, then the process id in it can be tested to
>see if it is that of an existing process (and if not, that process
>crashed and the lock file can be superseded).  But if the host name in
>the lock file is that of a different host, we refuse to supersede the
>lock.

But if you allow both processes to run on different hosts, you need to 
modify the other parts of rn that deal with the .newsrc and other related
status/setup files.  You will run into real problems when two processes 
try to write out different .newsrc files.


-- 
Conor P. Cahill            (703)430-9247        Virtual Technologies, Inc.,
uunet!virtech!cpcahil                           46030 Manekin Plaza, Suite 160
                                                Sterling, VA 22170 



More information about the Comp.unix.questions mailing list