# File lib/rufus/scheduler.rb, line 76
    def initialize(opts={})

      @opts = opts

      @started_at = nil
      @paused = false

      @jobs = JobArray.new

      @frequency = Rufus::Scheduler.parse(opts[:frequency] || 0.300)
      @mutexes = {}

      @work_queue = Queue.new

      #@min_work_threads = opts[:min_work_threads] || MIN_WORK_THREADS
      @max_work_threads = opts[:max_work_threads] || MAX_WORK_THREADS

      @stderr = $stderr

      @thread_key = "rufus_scheduler_#{self.object_id}"

      @scheduler_lock =
        if lockfile = opts[:lockfile]
          Rufus::Scheduler::FileLock.new(lockfile)
        else
          opts[:scheduler_lock] || Rufus::Scheduler::NullLock.new
        end

      @trigger_lock = opts[:trigger_lock] || Rufus::Scheduler::NullLock.new

      # If we can't grab the @scheduler_lock, don't run.
      @scheduler_lock.lock || return

      start
    end