This is indeed a race condition, but it looks like the fault may be in your
code.

The only thing that should transition the model from Stopped to Running is
a Resume message. If a Tick is received when the model is Stopped, the tick
needs to be ignored.

let
  model' =
    case msg of
      ...
      Tick dt ->
        case model of
          Stopped -> Stopped
          Running t -> Running (t + dt)
...

On Thu, May 26, 2016 at 8:00 AM, Fernando Alegre <[email protected]>
wrote:

>
>
> On Thursday, May 26, 2016 at 9:57:46 AM UTC-5, Fernando Alegre wrote:
>>
>> I may have found a possible race condition in Elm. It is illustrated
>> here:
>> https://gist.github.com/alphalambda/448099e95858b0ffc91fd41fdb1b437a
>>
>> If you click several times on the Pause/Resume button, it becomes
>> unresponsive after a while.
>>
>> I am using Google Chrome, so it may be a race condition in Chrome's event
>> handler. I am not sure. Any hints?
>>
>> Thanks
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to