lib/polyphony/extensions/thread.rb in polyphony-1.1.1 vs lib/polyphony/extensions/thread.rb in polyphony-1.2

- old
+ new

@@ -79,11 +79,10 @@ # @return [Thread] self def kill return self if @terminated raise Polyphony::Terminate - self end # @!visibility private alias_method :orig_inspect, :inspect @@ -158,12 +157,11 @@ # Finalizes the thread. # # @param result [any] thread's return value def finalize(result) - unless Fiber.current.children.empty? - Fiber.current.shutdown_all_children - end + Fiber.current.shutdown_all_children if !Fiber.current.children.empty? + @finalization_mutex.synchronize do @terminated = true @result = result signal_waiters(result) end