method
move
v1_9_2_180 -
Show latest stable
- Class:
Rinda::TupleSpace
move(port, tuple, sec=nil)public
Moves tuple to port.
# File lib/rinda/tuplespace.rb, line 485
def move(port, tuple, sec=nil)
template = WaitTemplateEntry.new(self, tuple, sec)
yield(template) if block_given?
synchronize do
entry = @bag.find(template)
if entry
port.push(entry.value) if port
@bag.delete(entry)
notify_event('take', entry.value)
return entry.value
end
raise RequestExpiredError if template.expired?
begin
@take_waiter.push(template)
start_keeper if template.expires
while true
raise RequestCanceledError if template.canceled?
raise RequestExpiredError if template.expired?
entry = @bag.find(template)
if entry
port.push(entry.value) if port
@bag.delete(entry)
notify_event('take', entry.value)
return entry.value
end
template.wait
end
ensure
@take_waiter.delete(template)
end
end
end Related methods
- Instance methods
- move
- notify
- read
- read_all
- take
- write
- Class methods
- new
- Private methods
-
create_entry -
keep_clean -
need_keeper? -
notify_event -
start_keeper