in reply to (tilly) : Can't find it :-(
in thread flock - lordy me....

I guess all bets are off in the case of kernel bugs. But I'd leave the manual flush in since the kernel might implement close() incorrectly and do the lock freeing before it does the buffer flushing.

I would hope that flock would return a failure indication if you used it on a filesystem where it wasn't supported. Not that anyone has been checking the return code in their examples so far...

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re (tilly) 2: Can't find it :-(
by tilly (Archbishop) on Jan 17, 2001 at 01:41 UTC
    Why do we always seem to disagree? :-)

    Yes, all bets are off in the case of a kernel/filesystem bug. But I am unconvinced that it is better to make it manual. I prefer the simpler code on general principles. But I would also isolate the calls into an atomic interface so that if something did go wrong I could fix more easily. Besides which, then I am in a better position to move to fcntl or some other kind of locking if I need it at some point.

    BTW I already did isolate locking somewhere else. And now you cannot complain that nobody has posted examples where the return code of flock is checked. :-)

    UPDATE
    Thanks tye for pointing out that one not was not wanted. That noted not was not for naught. :-)