lib/polyphony/extensions/thread.rb
# call-seq:
#   thread.raise
#   thread.raise(exception_class)
#   thread.raise(exception_instance)
# 
# Raises an exception in the context of the thread. If no exception is given,
# a `RuntimeError` is raised.
#
# @param error [Exception, Class, nil] exception spec


Raises an exception in the context of the thread. If no exception is given,
a `RuntimeError` is raised.
Raises an exception in the context of the thread . If no exception is given a ` RuntimeError ` is raised .
def raise(error = nil)
    Thread.pass until @main_fiber
    error = RuntimeError.new if error.nil?
    error = RuntimeError.new(error) if error.is_a?(String)
    error = error.new if error.is_a?(Class)
    sleep 0.0001 until @ready
    main_fiber&.raise(error)
  end
def raise ( error = nil ) Thread . pass until @main_fiber error = RuntimeError . new if error . nil? error = RuntimeError . new ( error ) if error . is_a? ( String ) error = error . new if error . is_a? ( Class ) sleep 0.0001 until @ready main_fiber &. raise ( error ) end
call-seq:
thread.raise
thread.raise(exception_class)
thread.raise(exception_instance)
call - seq : thread . raise thread . raise ( exception_class ) thread . raise ( exception_instance )
error
None