Skip to content

Commit

Permalink
Merge pull request #183 from JuliaGizmos/sd/07
Browse files Browse the repository at this point in the history
fix remaining depwarns - actually drop 0.6
  • Loading branch information
SimonDanisch committed Aug 22, 2018
2 parents 55105dd + f204792 commit e8b0075
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 25 deletions.
2 changes: 0 additions & 2 deletions src/Reactive.jl
@@ -1,5 +1,3 @@
__precompile__()

module Reactive

include("core.jl")
Expand Down
15 changes: 5 additions & 10 deletions src/core.jl
Expand Up @@ -27,11 +27,6 @@ const edges = Vector{Int}[] #parents to children, useful for plotting graphs

const node_count = Dict{String, Int}() #counts of different signals for naming

if VERSION < v"0.7.0-alpha.2"
const wait07 = wait
else
const wait07 = fetch
end

if !debug_memory
mutable struct Signal{T}
Expand Down Expand Up @@ -293,7 +288,7 @@ function stop()
# 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
wait07(runner_task[])
fetch(runner_task[])
end

"""
Expand Down Expand Up @@ -368,7 +363,7 @@ function run_push(pushnode::Signal, val, onerror, dont_remove_dead = false)
end
catch err
if isa(err, InterruptException)
info("Reactive event loop was inturrupted.")
@info("Reactive event loop was inturrupted.")
rethrow()
else
bt = catch_backtrace()
Expand Down Expand Up @@ -418,14 +413,14 @@ function maybe_restart_queue()
# will happen if `add_action!` is called while processing a push!
prev_runner = current_task()
@async begin
# new runner should wait07 for current runner to process the
# new runner should fetch for current runner to process the
# break_loop (null) message
wait07(prev_runner)
fetch(prev_runner)
runner_task[] = current_task()
run()
end
else
wait07(runner_task[])
fetch(runner_task[])
runner_task[] = @async run()
end
end
Expand Down
8 changes: 4 additions & 4 deletions test/queue_runner.jl
Expand Up @@ -16,7 +16,7 @@ import Reactive: runner_task
end
function test_queue(expected_bcount, orig_runner)
push!(a, 3)
wait07(Reactive.runner_task[])
fetch(Reactive.runner_task[])
@test (queue_size()) == (0)
@test (orig_runner) != (Reactive.runner_task[]) # we should have a new queue runner)
@test (bcount) == (expected_bcount)
Expand All @@ -43,7 +43,7 @@ import Reactive: runner_task
end
function test_queue(expected_bcount, orig_runner)
push!(a, 3)
wait07(Reactive.runner_task[])
fetch(Reactive.runner_task[])
@test (queue_size()) == (0)
@test (orig_runner) != Reactive.runner_task[] # we should have a new queue runner)
@test (bcount) == (expected_bcount)
Expand All @@ -68,7 +68,7 @@ import Reactive: runner_task
function test_queue(expected_bcount, orig_runner)
push!(a, 3)
push!(a, 4)
wait07(Reactive.runner_task[])
fetch(Reactive.runner_task[])
@test (queue_size()) == (0)
@test (orig_runner) != (Reactive.runner_task[]) # we should have a new queue runner)
@test (bcount) == (expected_bcount*2)
Expand All @@ -82,5 +82,5 @@ end

if !istaskdone(Reactive.runner_task[])
Reactive.stop()
wait07(Reactive.runner_task[])
fetch(Reactive.runner_task[])
end
9 changes: 1 addition & 8 deletions test/runtests.jl
@@ -1,14 +1,7 @@
using Reactive
if VERSION < v"0.7.0-DEV.2005"
using Base.Test
else
using Test
end
using Test
# Stop the runner task

using Reactive: wait07


@testset "Queue runner" begin
@test (istaskdone(Reactive.runner_task[])) == (false)
Reactive.stop()
Expand Down
2 changes: 1 addition & 1 deletion test/time.jl
Expand Up @@ -10,7 +10,7 @@
push!(b, true)

step() # processing the push to b will start the fpswhen's timer
# then we wait07 for two pushes from the timer, which should take ~ 1sec
# then we fetch for two pushes from the timer, which should take ~ 1sec
dt = @elapsed Reactive.run(2)
push!(b, false)
Reactive.run(1) # setting b to false should stop the timer
Expand Down

0 comments on commit e8b0075

Please sign in to comment.