protected function detach()
    {
        $this->getLogger()->debug('Detaching the ' . $this->name . ' daemon.');

        // Attempt to fork the process.
        $pid = $this->fork();

        // If the pid is positive then we successfully forked, and can close this application.
        if ($pid) {
            // Add the log entry for debugging purposes and exit gracefully.
            $this->getLogger()->debug('Ending ' . $this->name . ' parent process');

            $this->close();
        } else // We are in the forked child process.
        {
            // Setup some protected values.
            $this->exiting = false;
            $this->running = true;

            // Set the parent to self.
            $this->parentId = $this->processId;
        }
    }