Skip to content

Commit

Permalink
Merge b3422fa into 963245c
Browse files Browse the repository at this point in the history
  • Loading branch information
halorgium committed May 10, 2013
2 parents 963245c + b3422fa commit d68874d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/celluloid/calls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ def execute_block_on_receiver

def dispatch(obj)
_block = @block && @block.to_proc
obj.public_send(@method, *@arguments, &_block)
result = obj.public_send(@method, *@arguments, &_block)
# FIXME: we should only invalidate if the sender is not an actor
@block.invalidate if @block
result
rescue NoMethodError => ex
# Abort if the sender made a mistake
raise AbortError.new(ex) unless obj.respond_to? @method
Expand Down
5 changes: 5 additions & 0 deletions lib/celluloid/proxies/block_proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ def initialize(call, mailbox, block)
attr_writer :execution
attr_reader :call, :block

def invalidate
@invalid = true
end

def to_proc
if @execution == :sender
lambda do |*values|
raise "The original method call has completed, the block is now invalid" if @invalid
if task = Thread.current[:celluloid_task]
@mailbox << BlockCall.new(self, Actor.current.mailbox, values)
# TODO: if respond fails, the Task will never be resumed
Expand Down

0 comments on commit d68874d

Please sign in to comment.