Sha256: bbdedbccc95713eb33ef79cc41690f591b0d44d1b653e5d007813d08d7eb9abb

Contents?: true

Size: 1.18 KB

Versions: 21

Compression:

Stored size: 1.18 KB

Contents

require 'rbconfig'
require 'thread'

require 'concurrent/errors'
require 'concurrent/concern/deprecation'

module Concurrent
  extend Concern::Deprecation

  # [DEPRECATED] Wait the given number of seconds for the block operation to complete.
  # Intended to be a simpler and more reliable replacement to the Ruby
  # standard library `Timeout::timeout` method. It does not kill the task
  # so it finishes anyway. Advantage is that it cannot cause any ugly errors by
  # killing threads.
  #
  # @param [Integer] seconds The number of seconds to wait
  # @return [Object] The result of the block operation
  #
  # @raise [Concurrent::TimeoutError] when the block operation does not complete
  #   in the allotted number of seconds.
  #
  # @see http://ruby-doc.org/stdlib-2.2.0/libdoc/timeout/rdoc/Timeout.html Ruby Timeout::timeout
  #
  # @!macro monotonic_clock_warning
  #
  # @deprecated timeout is deprecated and will be removed
  def timeout(seconds, &block)
    deprecated 'timeout is deprecated and will be removed'

    future = Future.execute(&block)
    future.wait(seconds)
    if future.complete?
      future.value!
    else
      raise TimeoutError
    end
  end
  module_function :timeout
end

Version data entries

21 entries across 19 versions & 5 rubygems

Version Path
logstash-filter-zabbix-0.1.2 vendor/bundle/jruby/1.9/gems/concurrent-ruby-0.9.2-java/lib/concurrent/utility/timeout.rb
logstash-filter-zabbix-0.1.1 vendor/bundle/jruby/1.9/gems/concurrent-ruby-0.9.2-java/lib/concurrent/utility/timeout.rb
ivanvc-logstash-input-s3-3.1.1.4 vendor/local/gems/concurrent-ruby-0.9.2-java/lib/concurrent/utility/timeout.rb
ivanvc-logstash-input-s3-3.1.1.3 vendor/local/gems/concurrent-ruby-0.9.2-java/lib/concurrent/utility/timeout.rb
ivanvc-logstash-input-s3-3.1.1.2 vendor/local/gems/concurrent-ruby-0.9.2-java/lib/concurrent/utility/timeout.rb
logstash-input-beats-2.0.2 vendor/jruby/1.9/gems/concurrent-ruby-0.9.2-java/lib/concurrent/utility/timeout.rb
logstash-input-beats-2.0.2 vendor/jruby/1.9/gems/logstash-codec-json-2.0.3/vendor/gems/concurrent-ruby-0.9.1-java/lib/concurrent/utility/timeout.rb
logstash-input-beats-2.0.2 vendor/jruby/1.9/gems/concurrent-ruby-0.9.1-java/lib/concurrent/utility/timeout.rb
logstash-codec-json-2.0.3 vendor/gems/concurrent-ruby-0.9.1-java/lib/concurrent/utility/timeout.rb
concurrent-ruby-0.9.2-java lib/concurrent/utility/timeout.rb
concurrent-ruby-0.9.2 lib/concurrent/utility/timeout.rb
logstash-input-beats-0.9.2 vendor/jruby/1.9/gems/concurrent-ruby-0.9.1-java/lib/concurrent/utility/timeout.rb
logstash-input-beats-0.9.1 vendor/jruby/1.9/gems/concurrent-ruby-0.9.1-java/lib/concurrent/utility/timeout.rb
concurrent-ruby-0.9.1 lib/concurrent/utility/timeout.rb
concurrent-ruby-0.9.1-java lib/concurrent/utility/timeout.rb
concurrent-ruby-0.9.0 lib/concurrent/utility/timeout.rb
concurrent-ruby-0.9.0-java lib/concurrent/utility/timeout.rb
concurrent-ruby-0.9.0.pre3-java lib/concurrent/utility/timeout.rb
concurrent-ruby-0.9.0.pre3 lib/concurrent/utility/timeout.rb
concurrent-ruby-0.9.0.pre2 lib/concurrent/utility/timeout.rb