Class: FocusActor::FutureCell

Inherits:
Object
  • Object
show all
Defined in:
lib/focus_actor/future_cell.rb

Instance Method Summary collapse

Constructor Details

#initialize(queue) ⇒ FutureCell

Returns a new instance of FutureCell.



3
4
5
6
# File 'lib/focus_actor/future_cell.rb', line 3

def initialize(queue)
  @queue = queue
  @value_lock = Mutex.new
end

Instance Method Details

#valueObject



8
9
10
11
12
# File 'lib/focus_actor/future_cell.rb', line 8

def value
  @value ||= @value_lock.synchronize do
    @value ||= @queue.pop
  end
end