|laziness, impatience, and hubris|
Re^5: avoiding a race (the ado, you do, so well:)by BrowserUk (Pope)
|on Sep 29, 2010 at 19:56 UTC||Need Help??|
I don't see how you justify that the race doesn't result in extra e-mails. I believe your analysis is mistaken there.
And even in a full directory and an a loaded system, that time is going to be measured--assuming you can actually measure it at all--in low milliseconds at the most.
Now, what does that actually mean?
It means that one of the other processes encountered the same error as you, and succeeded in creating the error file within those few milliseconds. So what?
You then immediately overwrote it with a later time-stamp. But still, so what?
Nothing! Because the error file got created. Nothing is going to take any action--like sending emails--as a result of that files creation for another hour. From the OP:
if it has been encountered before and the time stamp is greater than an hour ago it will mail the admin
So the very worst affect of some other process creating the file instead of you, is that the sending of the email is delayed by the difference between the original time-stamp, and the new one. And that's just a few millseconds at most.
With 300 clients stating theFile (in a directory containing 1000 files), the window of opportunity for this irrelevant race condition is all of 300 milliseconds.
And then only if the time-stamp resolution of the file-system is sufficient to actually discern the difference, which is unlikely.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.