ruby-changes:62991
From: Benoit <ko1@a...>
Date: Thu, 17 Sep 2020 21:15:12 +0900 (JST)
Subject: [ruby-changes:62991] c3acfcc78d (master): Use a similar pattern for waiting and ready
https://git.ruby-lang.org/ruby.git/commit/?id=c3acfcc78d From c3acfcc78da84002b7dd5000bad21663f0773e2a Mon Sep 17 00:00:00 2001 From: Benoit Daloze <eregontp@g...> Date: Thu, 17 Sep 2020 12:55:17 +0200 Subject: Use a similar pattern for waiting and ready diff --git a/test/fiber/scheduler.rb b/test/fiber/scheduler.rb index d57e743..e0b3776 100644 --- a/test/fiber/scheduler.rb +++ b/test/fiber/scheduler.rb @@ -21,7 +21,7 @@ class Scheduler https://github.com/ruby/ruby/blob/trunk/test/fiber/scheduler.rb#L21 @lock = Mutex.new @locking = 0 - @ready = Array.new + @ready = [] end attr :readable @@ -68,8 +68,7 @@ class Scheduler https://github.com/ruby/ruby/blob/trunk/test/fiber/scheduler.rb#L68 if @waiting.any? time = current_time - waiting = @waiting - @waiting = {} + waiting, @waiting = @waiting, {} waiting.each do |fiber, timeout| if timeout <= time @@ -84,7 +83,7 @@ class Scheduler https://github.com/ruby/ruby/blob/trunk/test/fiber/scheduler.rb#L83 ready = nil @lock.synchronize do - ready, @ready = @ready, Array.new + ready, @ready = @ready, [] end ready.each do |fiber| -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/