class Concurrent::TimerSet

def post(delay, *args, &task)

Raises:
  • (ArgumentError) - if no block is given.
  • (ArgumentError) - if the intended execution time is not in the future.

Returns:
  • (Concurrent::ScheduledTask, false) - IVar representing the task if the post

Other tags:
    Yield: - the task to be performed.

Parameters:
  • args (Array) -- the arguments passed to the task on execution.
  • delay (Float) -- the number of seconds to wait for before executing the task.
  • def post(delay, *args, &task)
      raise ArgumentError.new('no block given') unless block_given?
      return false unless running?
      opts = { executor:  @task_executor,
               args:      args,
               timer_set: self }
      task = ScheduledTask.execute(delay, opts, &task) # may raise exception
      task.unscheduled? ? false : task
    end