ruby-changes:62995
From: Benoit <ko1@a...>
Date: Thu, 17 Sep 2020 22:04:18 +0900 (JST)
Subject: [ruby-changes:62995] deffb63021 (master): Document the various scheduler hooks
https://git.ruby-lang.org/ruby.git/commit/?id=deffb63021 From deffb630210e35da146c3cee5972fb405b0f00b5 Mon Sep 17 00:00:00 2001 From: Benoit Daloze <eregontp@g...> Date: Thu, 17 Sep 2020 14:52:04 +0200 Subject: Document the various scheduler hooks diff --git a/test/fiber/scheduler.rb b/test/fiber/scheduler.rb index f7a773a..193a824 100644 --- a/test/fiber/scheduler.rb +++ b/test/fiber/scheduler.rb @@ -114,6 +114,7 @@ class Scheduler https://github.com/ruby/ruby/blob/trunk/test/fiber/scheduler.rb#L114 return true end + # Used for Kernel#sleep and Mutex#sleep def kernel_sleep(duration = nil) # p [__method__, duration] if duration @@ -125,6 +126,7 @@ class Scheduler https://github.com/ruby/ruby/blob/trunk/test/fiber/scheduler.rb#L126 return true end + # Used when blocking on synchronization (Mutex#lock, Queue#pop, SizedQueue#push, ...) def block(blocker) # p [__method__, blocker] @locking += 1 @@ -133,6 +135,7 @@ class Scheduler https://github.com/ruby/ruby/blob/trunk/test/fiber/scheduler.rb#L135 @locking -= 1 end + # Used when synchronization wakes up a previously-blocked fiber (Mutex#unlock, Queue#push, ...) def unblock(blocker, fiber) # p [__method__, blocker, fiber] @lock.synchronize do -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/