diff --git a/src/core.jl b/src/core.jl index 3c1e122..a5beb3e 100644 --- a/src/core.jl +++ b/src/core.jl @@ -254,8 +254,13 @@ function break_loop() end function stop() + global runner_task run_till_now() # process all remaining events break_loop() + # it seems to take a long time until the runner_task is actually finished + # which can be enough to run into maybe_restart_queue with !isdone(runner_task) + # see #144 + wait(runner_task) end """ diff --git a/test/runtests.jl b/test/runtests.jl index f0ae2cc..a984515 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,11 +3,14 @@ using FactCheck # Stop the runner task -if !istaskdone(Reactive.runner_task) + +facts("Queue runner") do + @fact istaskdone(Reactive.runner_task) --> false Reactive.stop() - wait(Reactive.runner_task) + @fact istaskdone(Reactive.runner_task) --> true end + step() = Reactive.run(1) queue_size() = Base.n_avail(Reactive._messages) number() = round(Int, rand()*1000)