Xref: utzoo comp.unix.questions:15235 comp.sys.mips:46 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!boulder!ccncsu!segovia.CS.ColoState.Edu!wendt From: wendt@segovia.CS.ColoState.Edu (alan l wendt) Newsgroups: comp.unix.questions,comp.sys.mips Subject: Re: Should two exclusive flock(2)'s by same process succeed? Message-ID: <2279@ccncsu.ColoState.EDU> Date: 27 Jul 89 21:00:20 GMT References: <136@uakari.primate.wisc.edu> <12287@s.ms.uky.edu> Sender: news@ccncsu.ColoState.EDU Reply-To: wendt@segovia.CS.ColoState.Edu.UUCP (alan l wendt) Organization: /etc/organization Lines: 16 The second exclusive lock should fail, because that's safer. The two calls might very well be embedded deep in libraries and not know about each other. If you do an flock it's usually because you intend to read something in and modify it, and if you allow pairs of locks in the same process you can get duplicated bits of data. With two widely separated flock calls for which you may not even have source code, you can't assume that the conflict is benign. If you want conflicting locks to succeed within a single process, on the other hand, it will usually be because you yourself are writing both flock calls and know that the conflict is benign. In that case, you can easily implement your preference by interpolating your own manager in between your calls and the calls on flock. Alan Wendt