in reply to Re: AnyEvent timers by EV
in thread AnyEvent timers by EV
What you are probably dealing with here is an innocuous expression of what’s called a “race condition.”
Balooney, its simple granularity, same as with sleep
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: AnyEvent timers by EV
by locked_user sundialsvc4 (Abbot) on Apr 02, 2015 at 01:03 UTC | |
Not so fast . . . kindly please do not automatically presume that I know not whereof I speak, and thus to dismiss what <<I>&;gt; say on just that reason. :-) In the instant case, a local timer, running for so-many milliseconds locally, is being set against a timeout of a remote TCP/IP exchange. Necessarily, a timeout against a remote machine will require some additional milliseconds to resolve ... milliseconds spent informing the client that a timeout has, in fact, occurred. The AnyEvent authors were obviously very sensitive to such issues, and they actually spent quite a bit of time in their documentation discussing it. It appears to me that the OP’s test-case does not take these issues into proper account, thereby leading to the (erroneous?) observation of “even/odd.” Basically, “it will take you somewhat-more than 200 milliseconds to conclude that a 200-millisecond timeout has timed-out.” (And, as Anonymous Monk originally observed, it is actually quite unpredictable just how many “more than” milliseconds, might be required.) A strictly-local timer knows nothing of real-world network delays, whereas a valid conclusion cannot ignore them. C’est la guerre ...
EDIT: Kindly now draw your attention to what krambambuli subsequently posted. I think he hit an important nail on the head here ... and something I did not know ... to decisively explain the “even/odd” behavior. | |
by bash (Scribe) on Apr 02, 2015 at 14:44 UTC | |
So It's seems that problem from my 1 test-code is related to network "magic". test-code 2: pure timers And result: 1 - timer invoked exactly after 2 sec of real time 2 - timer set when internal time and real time has 5 sec lag. So timer invoked immediately. 3..4 like 2 iteration But Im still interested in my first test-code... just for self-education. | [reply] [d/l] [select] |
by Anonymous Monk on Apr 02, 2015 at 01:44 UTC | |
Not so fast . . . kindly please do not automatically presume that I know not whereof I speak, and thus to dismiss what say on just that reason. :-) Automatically? I quoted the baloney line .. timing issues (fuzziness) do not mean race condition they mean timing issues ... doesn't matter at what rate you blink if you've got baloney glasses | [reply] |