filelock

A platform independent file lock.

Here are some articles that you may find helpful