in reply to Flocking .l file instead of file to be updated

You don't want to unlink your lockfiles. In UNIX, it's possible to unlink a file that's opened by another process, so you can get this sequence:

At this point, both B and C think they have exclusive access to the resource. It is very easy to cause this situation to occur. Doing the unlink before the unlock doesn't help; the problem is that B is still trying to lock the old file that A unlinked. Don't unlink lockfiles unless you're into pain. Just leave them there.

  • Comment on Re: Flocking .l file instead of file to be updated