flock()'ing : the final frontier
A client is asking for some simple file read/write stuff for his website. Read a value from a file, add another value to it, write it back out to the file. Simple, right?
He used the phrase "locking will be required" in his specs. How the hell do clients come up with these terms when they're not supposed to know anything about programming? Was it on Oprah today? Hrmph, anyway.
I'm reading PHP's information on flock() along with the user-contributed notes (they posted my note on array_filter, by the way - I'm famous!) and I'm a little lost. If I can't acquire an exclusive lock, the function will return false in which case an error message is displayed. Obviously I don't want an otherwise seamless addition to this guy's system to come up with an error message about locking half the time.
I got this vague sense that maybe it would wait a bit and then try the lock again, but I'm still fuzzy on that whole thing. I'm still researching, but I thought I'd throw a note in here in case anyone has some science they felt like dropping.
TIA.
He used the phrase "locking will be required" in his specs. How the hell do clients come up with these terms when they're not supposed to know anything about programming? Was it on Oprah today? Hrmph, anyway.
I'm reading PHP's information on flock() along with the user-contributed notes (they posted my note on array_filter, by the way - I'm famous!) and I'm a little lost. If I can't acquire an exclusive lock, the function will return false in which case an error message is displayed. Obviously I don't want an otherwise seamless addition to this guy's system to come up with an error message about locking half the time.
I got this vague sense that maybe it would wait a bit and then try the lock again, but I'm still fuzzy on that whole thing. I'm still researching, but I thought I'd throw a note in here in case anyone has some science they felt like dropping.
TIA.
