lib/polyphony/core/global_api.rb
# Helper method for performing a `cancel_after` with optional reset.
#
# @param interval [Number] timeout interval in seconds
# @param exception [Exception, Class, Array<class, message>] exception spec
# @param &block [Proc] block to run
# @return [any] block's return value
Helper method for performing a `cancel_after` with optional reset.
Helper method for performing a ` cancel_after ` with optional reset .
def cancel_after_with_optional_reset(interval, exception, &block)
      canceller = spin do
        sleep interval
        exception = cancel_exception(exception)
        exception.raising_fiber = Fiber.current
        fiber.cancel(exception).await
      end
      block.call(canceller)
    ensure
      canceller.stop
    end
def cancel_after_with_optional_reset ( interval , exception , & block ) canceller = spin do sleep interval exception = cancel_exception ( exception ) exception . raising_fiber = Fiber . current fiber . cancel ( exception ) . await end block . call ( canceller ) ensure canceller . stop end
Helper method for performing a `cancel_after` with optional reset.
Helper method for performing a ` cancel_after ` with optional reset .
block's return value
block ' s return value
any
interval
timeout interval in seconds
timeout interval in seconds
exception
None
block
<not_specific>
&block
<not_specific>
block to run
block to run