summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2020-09-17 14:52:04 +0200
committerBenoit Daloze <eregontp@gmail.com>2020-09-17 14:59:38 +0200
commitdeffb630210e35da146c3cee5972fb405b0f00b5 (patch)
treed239158d26eeb3ce7ed6de754e68e724ec2559f3
parent9472d160619861201bad91560c06248fef8362dc (diff)
downloadruby-deffb630210e35da146c3cee5972fb405b0f00b5.tar.gz
Document the various scheduler hooks
-rw-r--r--test/fiber/scheduler.rb3
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