From b5a24fdbf928b675e478987393212651ef5909d6 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 18 Jun 2010 08:10:00 +0000 Subject: fiber/base: more accurate sleep timeout Not that many people will actually call Rainbows.sleep outside of tests... --- lib/rainbows/fiber/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/rainbows/fiber') diff --git a/lib/rainbows/fiber/base.rb b/lib/rainbows/fiber/base.rb index 54f797b..ee9e68e 100644 --- a/lib/rainbows/fiber/base.rb +++ b/lib/rainbows/fiber/base.rb @@ -61,13 +61,13 @@ module Rainbows ZZ.delete_if { |fib, time| if now >= time fibs << fib - now = Time.now else max = time false end } fibs.each { |fib| fib.resume } + now = Time.now max.nil? || max > (now + 1) ? 1 : max - now end -- cgit v1.2.3-24-ge0c7