in reply to How to do atomic file locking?
It is also important to consider the operating-system and file-system. Some scenarios provide only “advisory locking.” Here is a good web-page that discusses the issue for Linux ... but Windows is different. The flock perldoc page is mandatory reading.
You also need to be sure that all disk writes are actually complete before you unlock. This StackOverflow article seems like a good one to peruse.
Remember that, if you have a more-complicated situation (and if you can be certain that no “unaware” programs might be accessing the same files at the same time), you can use a “lock file” ... a dummy file whose only purpose is to be the target of lock/unlock requests.
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to do atomic file locking?
by Acapulco (Novice) on Aug 26, 2015 at 17:03 UTC |