This subject has been dealt with previously (a number of times! ;--) The best answer I've seen, using a lock on a separate file to ensure there is no race condition, is KM's RE: File Locking.
In reply to Re: (OT?) File Locking
by mirod
in thread (OT?) File Locking
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |