lib/resque/worker.rb
# Not every platform supports fork. Here we do our magic to
# determine if yours does.
Not every platform supports fork. Here we do our magic to
determine if yours does.
Not every platform supports fork . Here we do our magic to determine if yours does .
def fork(job,&block)
      return if @cant_fork
      run_hook :before_fork, job if will_fork?
      begin
        if Kernel.respond_to?(:fork)
          Kernel.fork(&block) if will_fork?
        else
          raise NotImplementedError
        end
      rescue NotImplementedError
        @cant_fork = true
        nil
      end
    end
def fork ( job , & block ) return if @cant_fork run_hook :before_fork , job if will_fork? begin if Kernel . respond_to? ( :fork ) Kernel . fork ( & block ) if will_fork? else raise NotImplementedError end rescue NotImplementedError @cant_fork = true nil end end
Not every platform supports fork.
Not every platform supports fork .
# Only run before_fork hooks if we're actually going to fork # (after checking @cant_fork) # IronRuby doesn't support `Kernel.fork` yet
job
block