lib/celluloid/io/mailbox.rb in celluloid-io-0.12.1 vs lib/celluloid/io/mailbox.rb in celluloid-io-0.13.0.pre
- old
+ new
@@ -3,12 +3,12 @@
# An alternative implementation of Celluloid::Mailbox using Reactor
class Mailbox < Celluloid::Mailbox
attr_reader :reactor
def initialize(reactor = nil)
- @messages = []
- @mutex = Mutex.new
+ super()
+ # @condition won't be used in the class.
@reactor = reactor || Reactor.new
end
# Add a message to the Mailbox
def <<(message)
@@ -24,10 +24,10 @@
else
raise MailboxError, "dead recipient" if @dead
@messages << message
end
- current_actor = Thread.current[:actor]
+ current_actor = Thread.current[:celluloid_actor]
@reactor.wakeup unless current_actor && current_actor.mailbox == self
rescue IOError
raise MailboxError, "dead recipient"
ensure
@mutex.unlock rescue nil