Sha256: b7ba8c918cc35a9db94c54439d9a1609aa87a1f9bad1bbd2fc3896f48f350931

Contents?: true

Size: 857 Bytes

Versions: 21

Compression:

Stored size: 857 Bytes

Contents

require 'concurrent/configuration'
require 'concurrent/concern/deprecation'

module Concurrent
  extend Concern::Deprecation

  # [DEPRECATED] Perform the given operation asynchronously after
  # the given number of seconds.
  #
  # @param [Fixnum] seconds the interval in seconds to wait before executing the task
  #
  # @yield the task to execute
  #
  # @return [Concurrent::ScheduledTask] IVar representing the task
  #
  # @see Concurrent::ScheduledTask
  #
  # @deprecated use `ScheduledTask` instead
  def timer(seconds, *args, &block)
    deprecated_method 'Concurrent.timer', 'ScheduledTask'
    raise ArgumentError.new('no block given') unless block_given?
    raise ArgumentError.new('interval must be greater than or equal to zero') if seconds < 0
    Concurrent.global_timer_set.post(seconds, *args, &block)
  end
  module_function :timer
end

Version data entries

21 entries across 19 versions & 5 rubygems

Version Path
concurrent-ruby-0.9.0.pre2-java lib/concurrent/utility/timer.rb