lib/celluloid/tasks/task_thread.rb in celluloid-0.12.0.pre3 vs lib/celluloid/tasks/task_thread.rb in celluloid-0.12.0

- old
+ new

@@ -15,19 +15,18 @@ actor, mailbox = Thread.current[:actor], Thread.current[:mailbox] raise NotActorError, "can't create tasks outside of actors" unless actor @thread = InternalPool.get do begin - value = @resume_queue.pop - raise value if value.is_a?(Task::TerminatedError) + unless @resume_queue.pop.is_a?(Task::TerminatedError) + @status = :running + Thread.current[:actor] = actor + Thread.current[:mailbox] = mailbox + Thread.current[:task] = self + actor.tasks << self - @status = :running - Thread.current[:actor] = actor - Thread.current[:mailbox] = mailbox - Thread.current[:task] = self - actor.tasks << self - - yield + yield + end rescue Task::TerminatedError # Task was explicitly terminated ensure @status = :dead actor.tasks.delete self