Sha256: 16516e7a20e6fe1bc29698206c26fe80fbdaeff2260b8dbe865231e30c7ea3fe

Contents?: true

Size: 364 Bytes

Versions: 1

Compression:

Stored size: 364 Bytes

Contents

require 'concurrent/obligation'

module Concurrent

  class Contract
    include Obligation

    def initialize(opts = {})
      @state = :pending
      init_mutex
      set_deref_options(opts)
    end

    def complete(value, reason)
      @value = value
      @reason = reason
      @state = ( reason ? :rejected : :fulfilled )
      event.set
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
concurrent-ruby-0.4.1 lib/concurrent/contract.rb