Sha256: 6a9f84aef2d6d7ba5bc070c2751088d92201ab1299d74c0f76f1967bbf6c6a5b

Contents?: true

Size: 928 Bytes

Versions: 5

Compression:

Stored size: 928 Bytes

Contents

# frozen_string_literal: true

export :Interrupt, :MoveOn, :Cancel

# Common exception class for interrupting fibers. These exceptions allow
# control of fibers. Interrupt exceptions can encapsulate a value and thus
# provide a way to interrupt long-running blocking operations while still
# passing a value back to the call site. Interrupt exceptions can also
# references a cancel scope in order to allow correct bubbling of exceptions
# through nested cancel scopes.
class Interrupt < ::Exception
  attr_reader :scope, :value

  def initialize(scope = nil, value = nil)
    @scope = scope
    @value = value
  end
end

# MoveOn is used to interrupt a long-running blocking operation, while
# continuing the rest of the computation.
class MoveOn < Interrupt; end

# Cancel is used to interrupt a long-running blocking operation, bubbling the
# exception up through cancel scopes and supervisors.
class Cancel < Interrupt; end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
polyphony-0.29 lib/polyphony/core/exceptions.rb
polyphony-0.28 lib/polyphony/core/exceptions.rb
polyphony-0.27 lib/polyphony/core/exceptions.rb
polyphony-0.26 lib/polyphony/core/exceptions.rb
polyphony-0.25 lib/polyphony/core/exceptions.rb