Methods
Class Public methods
new() Link
Source: show
# File actioncable/lib/action_cable/connection/stream_event_loop.rb, line 8 def initialize @nio = @executor = @thread = nil @map = {} @stopping = false @todo = Queue.new @spawn_mutex = Mutex.new end
Instance Public methods
attach(io, stream) Link
Source: show
# File actioncable/lib/action_cable/connection/stream_event_loop.rb, line 28 def attach(io, stream) @todo << lambda do @map[io] = @nio.register(io, :r) @map[io].value = stream end wakeup end
detach(io, stream) Link
Source: show
# File actioncable/lib/action_cable/connection/stream_event_loop.rb, line 36 def detach(io, stream) @todo << lambda do @nio.deregister io @map.delete io io.close end wakeup end
post(task = nil, &block) Link
Source: show
# File actioncable/lib/action_cable/connection/stream_event_loop.rb, line 21 def post(task = nil, &block) task ||= block spawn @executor << task end
stop() Link
Source: show
# File actioncable/lib/action_cable/connection/stream_event_loop.rb, line 54 def stop @stopping = true wakeup if @nio end