diff --git a/test/async/reactor.rb b/test/async/reactor.rb index 70516f8d..abac8f5c 100644 --- a/test/async/reactor.rb +++ b/test/async/reactor.rb @@ -5,6 +5,7 @@ # Copyright, 2017, by Devin Christensen. require "async" +require "async/variable" require "sus/fixtures/async" require "benchmark/ips" @@ -229,14 +230,14 @@ start_time = Time.now subject.run do |task| - condition = Async::Condition.new + variable = Async::Variable.new task.with_timeout(duration) do task.async do - condition.wait + variable.wait end - condition.signal + variable.resolve task.yield diff --git a/test/async/task.rb b/test/async/task.rb index 4e2e32f5..3a3ebe98 100644 --- a/test/async/task.rb +++ b/test/async/task.rb @@ -50,18 +50,18 @@ it "can yield back to scheduler" do state = nil - reactor.async do |task| + reactor.run do |task| child = task.async do state = :yielding Async::Task.yield state = :yielded end + # Async::Task. + Fiber.scheduler.resume(child.fiber) end - reactor.run - expect(state).to be == :yielded end end