I am attempting to pin down a good practice to use with some of our code which uses fopen() to re-write files on our server when they are updated with information. My main concern is what happens when the following two instances collide: One person is requesting the file via http and at the same instance the server is attempting to update the file via fopen().
I could just as easily check to see if fopen succeeded and if not loop a couple more times and make the same attempt, seems clunky to me however.
Hoping someone may be able to share some insight or possibly a solution to making sure the read-write issues are microseconds behind each other...
Thanks All!