Sha256: c724c961322e91d8ed0b2e88c81b82da6edab78b88540215693e8ca9a04b6c77
Contents?: true
Size: 783 Bytes
Versions: 3
Compression:
Stored size: 783 Bytes
Contents
require 'thread' require 'timeout' require 'concurrent/event' module Concurrent module Obligation attr_reader :state attr_reader :reason # Has the obligation been fulfilled? # @return [Boolean] def fulfilled?() return(@state == :fulfilled); end alias_method :realized?, :fulfilled? # Has the promise been rejected? # @return [Boolean] def rejected?() return(@state == :rejected); end # Is obligation completion still pending? # @return [Boolean] def pending?() return(@state == :pending); end def value(timeout = nil) event.wait(timeout) unless timeout == 0 || @state != :pending return @value end alias_method :deref, :value protected def event @event ||= Event.new end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
concurrent-ruby-0.3.0 | lib/concurrent/obligation.rb |
concurrent-ruby-0.3.0.pre.3 | lib/concurrent/obligation.rb |
concurrent-ruby-0.3.0.pre.2 | lib/concurrent/obligation.rb |