Sha256: 5b83013e80cd1ab0fc27581d1d62aeca11917a9d691382e191db65df920ceba1
Contents?: true
Size: 625 Bytes
Versions: 54
Compression:
Stored size: 625 Bytes
Contents
require 'concurrent/configuration' require 'thread' module Concurrent # 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 [Boolean] true def timer(seconds, *args, &block) 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.configuration.global_timer_set.post(seconds, *args, &block) true end module_function :timer end
Version data entries
54 entries across 54 versions & 1 rubygems