[前][次][番号順一覧][スレッド一覧]

ruby-changes:63546

From: Samuel <ko1@a...>
Date: Sun, 8 Nov 2020 16:41:14 +0900 (JST)
Subject: [ruby-changes:63546] 57b83dad4c (master): Defer `kernel_sleep` to `block` to avoid exiting the event loop when duration is nil.

https://git.ruby-lang.org/ruby.git/commit/?id=57b83dad4c

From 57b83dad4cd3c7d4b2a29829a1cb194c9b5ee9d1 Mon Sep 17 00:00:00 2001
From: Samuel Williams <samuel.williams@o...>
Date: Sun, 8 Nov 2020 16:19:39 +1300
Subject: Defer `kernel_sleep` to `block` to avoid exiting the event loop when
 duration is nil.


diff --git a/test/fiber/scheduler.rb b/test/fiber/scheduler.rb
index 408e0e5..8879048 100644
--- a/test/fiber/scheduler.rb
+++ b/test/fiber/scheduler.rb
@@ -135,12 +135,7 @@ class Scheduler https://github.com/ruby/ruby/blob/trunk/test/fiber/scheduler.rb#L135
 
   # Used for Kernel#sleep and Mutex#sleep
   def kernel_sleep(duration = nil)
-    # p [__method__, duration]
-    if duration
-      @waiting[Fiber.current] = current_time + duration
-    end
-
-    Fiber.yield
+    self.block(:sleep, duration)
 
     return true
   end
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]