Sha256: de39dbfc2787d571827bd5f0c515d3f3e70797181442a2dd2fc6b5c10646a6a0

Contents?: true

Size: 432 Bytes

Versions: 3

Compression:

Stored size: 432 Bytes

Contents

module DeepTest
  class ThreadAgent < Agent
    attr_reader :work_done

    def initialize(options)
      super(0, options, ListenerList.new([]))
      @thread = Thread.new { execute(StringIO.new, StringIO.new) }
      @work_done = 0
    end

    def wait_until_done
      Timeout.timeout(5) {@thread.join}
      @thread.kill if @thread.alive?
    end

    def send_result(*args)
      super
      @work_done += 1
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jstorimer-deep-test-2.0.0 infrastructure/thread_agent.rb
jstorimer-deep-test-0.2.0 infrastructure/thread_agent.rb
jstorimer-deep-test-0.1.0 infrastructure/thread_agent.rb