Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!execu!sequoia!rpp386!jfh From: jfh@rpp386.cactus.org (John F. Haugh II) Newsgroups: comp.unix.wizards Subject: Re: Is HDB locking safe? Message-ID: <18500@rpp386.cactus.org> Date: 17 Aug 90 13:09:16 GMT References: <577@oglvee.UUCP> <4024@rtifs1.UUCP> Reply-To: jfh@rpp386.cactus.org (John F. Haugh II) Organization: Lone Star Cafe and BBS Service Lines: 15 X-Clever-Slogan: Recycle or Die. In article peter@ficc.ferranti.com (Peter da Silva) writes: >In article <4024@rtifs1.UUCP> trt@rti.rti.org (Thomas Truscott) writes: >> (a) A "sleep(1);" is not enough to avoid a race on a very busy system. > >No sleep is ever enough. The system could simply be busier than you ever >imagined. You don't solve a race problem by narrowing the window: try >checking the return value of the "unlink": that's the point of failure. There is a big, fat window between the kill() and the unlink() during which time the other process and kill() the dead process, unlink() the stale lock, and creat() the new lock file. Your process will then unlink() a lock which has just be created. -- John F. Haugh II UUCP: ...!cs.utexas.edu!rpp386!jfh Ma Bell: (512) 832-8832 Domain: jfh@rpp386.cactus.org