diff options
author | Benoit Daloze <eregontp@gmail.com> | 2020-09-17 14:52:04 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2020-09-17 14:59:38 +0200 |
commit | deffb630210e35da146c3cee5972fb405b0f00b5 (patch) | |
tree | d239158d26eeb3ce7ed6de754e68e724ec2559f3 | |
parent | 9472d160619861201bad91560c06248fef8362dc (diff) | |
download | ruby-deffb630210e35da146c3cee5972fb405b0f00b5.tar.gz |
Document the various scheduler hooks
-rw-r--r-- | test/fiber/scheduler.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/fiber/scheduler.rb b/test/fiber/scheduler.rb index f7a773ade1..193a824f7f 100644 --- a/test/fiber/scheduler.rb +++ b/test/fiber/scheduler.rb @@ -114,6 +114,7 @@ class Scheduler 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 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 @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 |