in reply to (OT?) File Locking

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.