class Immutable::Splitter::Left
@private
Public Class Methods
new(splitter, buffer, mutex)
click to toggle source
Calls superclass method
Immutable::Realizable::new
# File lib/immutable/list.rb, line 1509 def initialize(splitter, buffer, mutex) super() @splitter, @buffer, @mutex = splitter, buffer, mutex end
Public Instance Methods
realize()
click to toggle source
# File lib/immutable/list.rb, line 1514 def realize # another thread may get ahead of us and null out @mutex mutex = @mutex mutex && mutex.synchronize do return if @head != Undefined # another thread got ahead of us while true if !@buffer.empty? @head = @buffer.shift @tail = Left.new(@splitter, @buffer, @mutex) @splitter, @buffer, @mutex = nil, nil, nil return elsif @splitter.done? @head, @size, @tail = nil, 0, self @splitter, @buffer, @mutex = nil, nil, nil return else @splitter.next_item end end end end