ultravisor/lib/ultravisor/child.rb in service_skeleton-1.0.4 vs ultravisor/lib/ultravisor/child.rb in service_skeleton-1.0.5

- old
+ new

@@ -183,17 +183,17 @@ end !!(@restart == :always || (@restart == :on_failure && termination_exception)) end - def unsafe_instance + def unsafe_instance(wait: true) unless @access == :unsafe raise Ultravisor::ThreadSafetyError, "#unsafe_instance called on a child not declared with access: :unsafe" end - current_instance + current_instance(wait: wait) end def cast unless castcall_enabled? raise NoMethodError, @@ -392,12 +392,12 @@ i.instance_variable_set(:@ultravisor_child_castcall_fd, r) end end end - def current_instance + def current_instance(wait: true) @spawn_m.synchronize do - while @instance.nil? + while wait && @instance.nil? @spawn_cv.wait(@spawn_m) end return @instance end