+ /* If we set a timer, try and stop it. But if it believes it's
+ not running, that means that the execution of its fired event
+ is pending, so we:
+ - don't need to call executeTimers (it will happen soon)
+ - we must not call executeTimers, because that would change the
+ timer's setting, confusing the pending call to TimerFrom.fired
+ (it would call executeTimers with an incorrect "then"
+ parameter)
+ We need to use an atomic section even though it's a "timer",
+ because it's based on an underlying alarm, whose transitions
+ are asynchronous (yuck?)
+ */
+ if (state & S_TIMER_RUNNING)
+ atomic
+ {
+ if (!call TimerFrom.isRunning())
+ return;
+ call TimerFrom.stop();
+ }