lib/celluloid/mailbox/evented.rb in celluloid-0.18.0.pre vs lib/celluloid/mailbox/evented.rb in celluloid-0.18.0.pre2

- old
+ new

@@ -24,17 +24,21 @@ @messages.unshift message else @messages << message end ensure - @mutex.unlock rescue nil + begin + @mutex.unlock + rescue + nil + end end begin current_actor = Thread.current[:celluloid_actor] @reactor.wakeup unless current_actor && current_actor.mailbox == self - rescue - Internals::Logger.crash "reactor crashed", $ERROR_INFO + rescue => ex + Internals::Logger.crash "reactor crashed", ex dead_letter(message) end nil end @@ -48,19 +52,23 @@ # ... otherwise, run the reactor once, either blocking or will return # after the given timeout: @reactor.run_once(timeout) # No message was received: - return nil + nil end # Obtain the next message from the mailbox that matches the given block def next_message(block) @mutex.lock begin super(&block) ensure - @mutex.unlock rescue nil + begin + @mutex.unlock + rescue + nil + end end end # Cleanup any IO objects this Mailbox may be using def shutdown