class AWS::Flow::Core::FiberConditionVariable
Represents a fiber condition variable. Based on the Ruby core source: github.com/ruby/ruby/blob/trunk/lib/thread.rb @api private
Public Class Methods
new()
click to toggle source
Creates a new ConditionVariable
@api private
# File lib/aws/flow/future.rb, line 106 def initialize @waiters = [] end
Public Instance Methods
broadcast()
click to toggle source
Wakes up all fibers waiting for this lock.
@api private
# File lib/aws/flow/future.rb, line 135 def broadcast signal until @waiters.empty? self end
signal()
click to toggle source
Wakes up the first fiber in line waiting for this lock.
@api private
# File lib/aws/flow/future.rb, line 125 def signal t = @waiters.shift t.schedule if t && t.alive? self end
wait()
click to toggle source
Have the current fiber wait on this condition variable, and wake up when the FiberConditionVariable
is signaled/broadcasted.
@api private
# File lib/aws/flow/future.rb, line 114 def wait fiber = ::Fiber.current @waiters << fiber Fiber.yield self end