Sha256: 71bb18e1493bb2e7092f6f772f9a5698753c918d6e1a03a669c6b87898c5b0ac

Contents?: true

Size: 360 Bytes

Versions: 3

Compression:

Stored size: 360 Bytes

Contents

module PbActor
  class Future
    def initialize id, wr, rd
      @id = id
      @wr= wr
      @rd = rd
    end

    def value
      loop do
        Message.send [:future_value_get, @id], @wr
        type, value = Message.recv @rd
        if type == :future_value
          break value
        else
          sleep 0.01
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pb_actor-0.0.5 lib/pb_actor/future.rb
pb_actor-0.0.4 lib/pb_actor/future.rb
pb_actor-0.0.3 lib/pb_actor/future.rb