What would you want to happen if 2 processes get read-only locks and then try to "upgrade" them at the same time to read-write? What reasonable semantics can you suggest for resolving this?
in reply to (tye)Re: flock() broken under FreeBSD?
in thread flock() broken under FreeBSD?
If there is no reasonable way to implement upgrades, then it is not unreasonable to say, Silly programmer. Upgrades don't exist. If you will want to write, then you should tell me that from the start!
Getting a shared lock is a promise that you won't be doing any modifications based on your read. Don't make that promise if it isn't true.