# File lib/rufus/sc/jobs.rb, line 117 def trigger (t=Time.now) @last = t @scheduler.send(:trigger_job, @params[:blocking]) do # # Note that #trigger_job is protected, hence the #send # (Only jobs know about this method of the scheduler) @job_thread = Thread.current begin #args = prepare_args #@block.call(*args) #@block.call(self) @block.respond_to?(:call) ? @block.call(self) : @block.trigger(@params) @job_thread = nil rescue Exception => e @scheduler.handle_exception(self, e) end end # note that add_job and add_cron_job ensured that :blocking is # not used along :timeout if to = @params[:timeout] @scheduler.in(to, :tags => 'timeout') do # at this point, @job_thread might be set @job_thread.raise(Rufus::Scheduler::TimeOutError) \ if @job_thread and @job_thread.alive? end end end