[fpc-devel] need to call FpFlock to unlock file in FileClose?

Vinzent Höfler JeLlyFish.software at gmx.net
Sat Oct 30 01:08:22 CEST 2010


On Sat, 30 Oct 2010 00:18:15 +0200, Seth Grover <sethdgrover at gmail.com>  
wrote:

> My question is this: if FileOpen automagically handles the file
> locking through a call to DoFileLocking, wouldn't it be more correct
> for FileClose handle unlocking as well?

It should, if it's necessary.

Interestingly

"man 2 flock" says:

|Furthermore, the lock is released either by an explicit LOCK_UN operation  
on
|any of these duplicate descriptors, or when all such descriptors have been
|closed.

So I would expect the lock to disappear when the file is closed. Nitpicking
people might say, this only applies to duplicated descriptors, but then
what's the point?

So, actually I'm inclined to consider that a bug in the underlying OS.


Vinzent.



More information about the fpc-devel mailing list