Ok, here some help to get you started :
- flock() is a function used to lock files.
- See the basic info here
- When to use it. flock() is used whenever two (or more) processes may try to access the same file at the same time. It gives you the abiality to have one process write at a time, and all reads will wait until the wrtie is complete.
There are some limitations to
flock().
- If there is a process which does not check for a lock, it will not stop it from writting. This means, that for flock() to work correctly, all processes which read/write the data file need to impliment flock().
- flock() is unimplimented on some OS's.
"They shall not overcome. Whoever told them that the truth shall set them free was obviously and grossly unfamiliar with federal law."
-- John Ashcroft