def start_child
      # Aquire the write lock, so we prevent anyone from using the child until
      # its setup or recreated.
      unless @drb_object
        # Get the id of the parent process, so we can wait for exit in the child
        # so the child can exit if the parent closes.
        @parent_id = Process.pid

        @reader, @writer = IO.pipe

        if @child_id = fork
          # running as parent
          @writer.close

          # Read the url from the child
          uri = @reader.gets.strip

          # Setup a drb object to the child
          DRb.start_service

          @drb_object = DRbObject.new_with_uri(uri)
          @server_proxy = @drb_object[0]
          @dispatcher_proxy = @drb_object[1]

          SocketConnectionHandler.dispatcher = @dispatcher_proxy

          start_change_listener
        else
          # Running as child
          @reader.close

          watch_for_parent_exit

          begin
            volt_app = @server.boot_volt
            @rack_app = volt_app.middleware

            # Set the drb object locally
            @dispatcher = Dispatcher.new(volt_app)
          rescue Exception => error
            boot_error(error)
          end


          drb_object = DRb.start_service('drbunix:', [self, @dispatcher])

          @writer.puts(drb_object.uri)

          begin
            DRb.thread.join
          rescue Interrupt => e
            # Ignore interrupt
            exit
          end
        end
      end
    end
def start_child
      # Aquire the write lock, so we prevent anyone from using the child until
      # its setup or recreated.
      unless @drb_object
        # Get the id of the parent process, so we can wait for exit in the child
        # so the child can exit if the parent closes.
        @parent_id = Process.pid

        @reader, @writer = IO.pipe

        if @child_id = fork
          # running as parent
          @writer.close

          # Read the url from the child
          uri = @reader.gets.strip

          # Setup a drb object to the child
          DRb.start_service

          @drb_object = DRbObject.new_with_uri(uri)
          @server_proxy = @drb_object[0]
          @dispatcher_proxy = @drb_object[1]

          SocketConnectionHandler.dispatcher = @dispatcher_proxy

          start_change_listener
        else
          # Running as child
          @reader.close

          watch_for_parent_exit

          begin
            volt_app = @server.boot_volt
            @rack_app = volt_app.middleware

            # Set the drb object locally
            @dispatcher = Dispatcher.new(volt_app)
          rescue Exception => error
            boot_error(error)
          end


          drb_object = DRb.start_service('drbunix:', [self, @dispatcher])

          @writer.puts(drb_object.uri)

          begin
            DRb.thread.join
          rescue Interrupt => e
            # Ignore interrupt
            exit
          end
        end
      end
    end
Start child forks off a child process and sets up a DRb connection to the
 child.  #start_child should be called from within the write lock.