From d0d47ab3c3280526d822576366b865057b70d199 Mon Sep 17 00:00:00 2001 From: SimonDanisch Date: Tue, 30 May 2017 00:02:10 +0200 Subject: [PATCH 1/3] fix #144 --- src/core.jl | 5 +++++ 1 file changed, 5 insertions(+) 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 """ From 0327331d1795d5cf8aa96f274e8368200a31bede Mon Sep 17 00:00:00 2001 From: SimonDanisch Date: Tue, 30 May 2017 15:12:54 +0200 Subject: [PATCH 2/3] remove unnecessary wait --- test/runtests.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index f0ae2cc..60c7394 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -5,7 +5,6 @@ using FactCheck if !istaskdone(Reactive.runner_task) Reactive.stop() - wait(Reactive.runner_task) end step() = Reactive.run(1) From e0c620d26753496e6d226448cbbd42627f06854d Mon Sep 17 00:00:00 2001 From: SimonDanisch Date: Tue, 30 May 2017 15:23:49 +0200 Subject: [PATCH 3/3] add test for stop --- test/runtests.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 60c7394..a984515 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,10 +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() + @fact istaskdone(Reactive.runner_task) --> true end + step() = Reactive.run(1) queue_size() = Base.n_avail(Reactive._messages) number() = round(Int, rand()*1000)