Class: Rinda::WaitTemplateEntry

Inherits:
TemplateEntry show all
Defined in:
lib/rinda/tuplespace.rb

Overview

Documentation?

Instance Attribute Summary collapse

Attributes inherited from TupleEntry

#expires

Instance Method Summary collapse

Methods inherited from TemplateEntry

#make_tuple, #match

Methods inherited from TupleEntry

#[], #alive?, #canceled?, #expired?, #fetch, #make_expires, #make_tuple, #renew, #size, #value

Constructor Details

#initialize(place, ary, expires = nil) ⇒ WaitTemplateEntry

Returns a new instance of WaitTemplateEntry.



185
186
187
188
189
190
# File 'lib/rinda/tuplespace.rb', line 185

def initialize(place, ary, expires=nil)
  super(ary, expires)
  @place = place
  @cond = place.new_cond
  @found = nil
end

Instance Attribute Details

#foundObject (readonly)

Returns the value of attribute found



183
184
185
# File 'lib/rinda/tuplespace.rb', line 183

def found
  @found
end

Instance Method Details

#cancelObject



192
193
194
195
# File 'lib/rinda/tuplespace.rb', line 192

def cancel
  super
  signal
end

#read(tuple) ⇒ Object



201
202
203
204
# File 'lib/rinda/tuplespace.rb', line 201

def read(tuple)
  @found = tuple
  signal
end

#signalObject



206
207
208
209
210
# File 'lib/rinda/tuplespace.rb', line 206

def signal
  @place.synchronize do
    @cond.signal
  end
end

#waitObject



197
198
199
# File 'lib/rinda/tuplespace.rb', line 197

def wait
  @cond.wait
end