def start(opts = {})
      # we can't block on the main thread, as signals interrupt that
      Thread.new do
        # needs to be done per-thread
        cfg = @config.all
        Flapjack.configure_log('flapjack-coordinator', cfg.nil? ? {} : cfg['logger'])

        @boot_time = Time.now

        Flapjack::RedisProxy.config = @config.for_redis

        pikelet_defs = pikelet_definitions(cfg)
        return if pikelet_defs.empty?

        create_pikelets(pikelet_defs).each do |pik|
          @pikelets << pik
        end

        @pikelets.each do |pik|
          pik.start
        end

        setup_signals if opts[:signals]

        # block this thread until 'stop' has been called, and
        # all pikelets have been stopped
        @monitor.synchronize {
          @state = :running
          @monitor_cond.wait_until { !(:running.eql?(@state)) }
          case @state
          when :reloading
            reload
            @state = :running
            @monitor_cond.signal
          when :stopping
            @pikelets.map(&:stop)
            @pikelets.clear
            @state = :stopped
            @monitor_cond.signal
          end
        }

      end.join

      @exit_value
    end
def start(opts = {})
      # we can't block on the main thread, as signals interrupt that
      Thread.new do
        # needs to be done per-thread
        cfg = @config.all
        Flapjack.configure_log('flapjack-coordinator', cfg.nil? ? {} : cfg['logger'])

        @boot_time = Time.now

        Flapjack::RedisProxy.config = @config.for_redis

        pikelet_defs = pikelet_definitions(cfg)
        return if pikelet_defs.empty?

        create_pikelets(pikelet_defs).each do |pik|
          @pikelets << pik
        end

        @pikelets.each do |pik|
          pik.start
        end

        setup_signals if opts[:signals]

        # block this thread until 'stop' has been called, and
        # all pikelets have been stopped
        @monitor.synchronize {
          @state = :running
          @monitor_cond.wait_until { !(:running.eql?(@state)) }
          case @state
          when :reloading
            reload
            @state = :running
            @monitor_cond.signal
          when :stopping
            @pikelets.map(&:stop)
            @pikelets.clear
            @state = :stopped
            @monitor_cond.signal
          end
        }

      end.join

      @exit_value
    end
states: :starting, :running, :reloading, :stopped