From 53bac4f65d9430495c8043b239cc936012ea7a8d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 6 Feb 2011 06:19:09 +0000 Subject: minimize &block usage for yield No need to allocate a proc every time when we can just yield much more efficiently. --- lib/rainbows/fiber/base.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/rainbows/fiber/base.rb') diff --git a/lib/rainbows/fiber/base.rb b/lib/rainbows/fiber/base.rb index 126f338..a4f2341 100644 --- a/lib/rainbows/fiber/base.rb +++ b/lib/rainbows/fiber/base.rb @@ -17,7 +17,7 @@ module Rainbows::Fiber::Base # schedules ones that were blocked on I/O. At most it'll sleep # for one second (returned by the schedule_sleepers method) which # will cause it. - def schedule(&block) + def schedule begin Rainbows.tick t = schedule_sleepers @@ -33,7 +33,7 @@ module Rainbows::Fiber::Base ret[1].concat(RD.compact & ret[0]).each { |c| c.f.resume } # accept is an expensive syscall, filter out listeners we don't want - (ret[0] & LISTENERS).each(&block) + (ret[0] & LISTENERS).each { |x| yield x } end # wakes up any sleepers or keepalive-timeout violators that need to be -- cgit v1.2.3-24-ge0c7