This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Help on posix file lock semantics

I'm joining this late, and may be misunderstanding 
something, but...

On 20 August 2001 at 23:25, Kurt Roeckx <> wrote:
> On Mon, Aug 20, 2001 at 10:55:54PM +0200, Gunnar Andre Dalsnes wrote:
> > >On Sun, Aug 19, 2001 at 11:06:13PM +0200, Gunnar Andre Dalsnes wrote:
>> Example:
>> A file has write lock from off. 10 to 20 and read lock from off. 30 to 40.
>> A new read lock from off. 15 to 35 upgrades both existing overlapped 
>> Now we have three locks?
>> -write lock off. 10 to 15
>> -read lock off. 15 to 35
>> -read lock off. 35 to 40
>> Or maybe they merged? 
>> -write lock off. 10 to 15
>> -read lock off. 15 to 40
>> The reason i ask is that i want F_GETLK to behave correctly if called 
>> afterwards.
> You got me there. :)
> I don't see anything in the standard that covers it, so I guess
> it's implementation defined.
> Otoh, is it really that important?

My understanding on the locks is that a Read lock is a downgrade
relative to a write lock.  A write lock is exclusive, and while a
read lock precludes others from writing, it doesn't preclude others
from reading.

With that assumption, you cannot merge and shrink the write lock,
but you would surely join the two read locks into a single lock.

Jerry Heyman   919.224.1442    | IBM SWG/Tivoli Software |"Software is the 
Build Infrastructure Architect | 3901 S Miami Blvd       | difference between         | Durham, NC  27703       | hardware and 

Unsubscribe info:
Bug reporting:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]