The trick is to ignore the open call in your sequence of locking. Two or more processes can (on Unixish operating systems) successfully call open() on the same file, but only one call to flock() will succeed. That should be enough for your program to know whether it is the instance that should proceed or not.
In reply to Re: How to do atomic file locking?
by Corion
in thread How to do atomic file locking?
by Acapulco
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |