After the fork. Now the process starts running
180840
def run(self): # No "_" in the name, but nevertheless, running in the backed
        
        self.preRun_()
        self.running=True
        
        while(self.running):
            if (self.active): # activated: shared mem client has been reserved
                self.cycle_()
            else:
                if (self.verbose): print(self.pre, "sleep")
                time.sleep(0.2)
            self.handleSignal_()
            
        self.postRun_()
700239
function restart() {
	logger.log('Restarting', clc.green(script));
	notifyWebSocket('restart');
	if (!kill(true)) {
		// The process wasn't running, start it now.
		start(true);
	} /*else {
		// The process will restart when its 'exit' event is emitted.
	}*/
}
414279
protected void afterFork(List<Boolean> forks, long startTimeNanos) {
    int forksGenerated = 0;
    for (Boolean fork : forks) {
      forksGenerated += fork ? 1 : 0;
    }
    Instrumented.markMeter(this.outputForks, forksGenerated);
    Instrumented.updateTimer(this.forkOperatorTimer, System.nanoTime() - startTimeNanos, TimeUnit.NANOSECONDS);
  }
179646
def run(self):
    """"""
    # Prevent the KeyboardInterrupt being raised inside the process.
    # This will prevent a process from generating a traceback when interrupted.
    signal.signal(signal.SIGINT, signal.SIG_IGN)

    # A SIGTERM signal handler is necessary to make sure IPC is cleaned up
    # correctly on terminate.
    signal.signal(signal.SIGTERM, self._SigTermHandler)

    # A SIGSEGV signal handler is necessary to try to indicate where
    # worker failed.
    # WARNING the SIGSEGV handler will deadlock the process on a real segfault.
    if self._enable_sigsegv_handler:
      self._original_sigsegv_handler = signal.signal(
          signal.SIGSEGV, self._SigSegvHandler)

    self._pid = os.getpid()
    self._process_information = process_info.ProcessInfo(self._pid)

    # We need to set the is running status explicitly to True in case
    # the process completes before the engine is able to determine
    # the status of the process, e.g. in the unit tests.
    self._status_is_running = True

    # Logging needs to be configured before the first output otherwise we
    # mess up the logging of the parent process.
    loggers.ConfigureLogging(
        debug_output=self._debug_output, filename=self._log_filename,
        quiet_mode=self._quiet_mode)

    logger.debug(
        'Process: {0!s} (PID: {1:d}) started'.format(self._name, self._pid))

    self._StartProcessStatusRPCServer()

    self._Main()

    self._StopProcessStatusRPCServer()

    logger.debug(
        'Process: {0!s} (PID: {1:d}) stopped'.format(self._name, self._pid))

    # Make sure log files are cleanly closed.
    logging.shutdown()

    self._status_is_running = False
579198
public void postProcess(DirContext ctx) throws NamingException {
        for (DirContextProcessor processor : dirContextProcessors) {
            processor.postProcess(ctx);
        }
    }
1363572
public function run()
    {
        pcntl_signal(SIGINT, array($this, 'stop'));
        pcntl_signal(SIGTERM, array($this, 'stop'));

        $this->running = true;
        while ($this->running) {
            $this->process();
        }
    }
594551
def run(self):
        '''
        
        '''
        salt.utils.process.appendproctitle(self.__class__.__name__)
        # Clean out the fileserver backend cache
        salt.daemons.masterapi.clean_fsbackend(self.opts)

        for interval in self.buckets:
            self.update_threads[interval] = threading.Thread(
                target=self.update_fileserver,
                args=(interval, self.buckets[interval]),
            )
            self.update_threads[interval].start()

        # Keep the process alive
        while True:
            time.sleep(60)
799796
public function runAfterView() {
        if($this->_afterView !== null) {
            foreach($this->_afterView as $hookProvider) {
                $hookProvider->doAfterView();
            }
        }
    }
1000006
public void run() {
      /**
        * Ensure we start fresh.
        */
    getLogger().debug("performing socket cleanup prior to entering loop for {}",  name);
    closeServerSocket();
    closeAllAcceptedSockets();
    getLogger().debug("socket cleanup complete for {}", name);       
    active = true;

    // start the server socket
    try {
      serverSocket = new ServerSocket(port);
    } catch (Exception e) {
      getLogger().error(
        "error starting SocketReceiver (" + this.getName()
        + "), receiver did not start", e);
      active = false;
      doShutdown();

      return;
    }

    Socket socket = null;

    try {
      getLogger().debug("in run-about to enter while isactiveloop");

      active = true;

      while (!rThread.isInterrupted()) {
        // if we have a socket, start watching it
        if (socket != null) {
          getLogger().debug("socket not null - creating and starting socketnode");
          socketList.add(socket);

          XMLSocketNode node = new XMLSocketNode(decoder, socket, this);
          node.setLoggerRepository(this.repository);
          new Thread(node).start();
          socket = null;
        }

        getLogger().debug("waiting to accept socket");

        // wait for a socket to open, then loop to start it
        socket = serverSocket.accept();
        getLogger().debug("accepted socket");
      }

      // socket not watched because we a no longer running
      // so close it now.
      if (socket != null) {
        socket.close();
      }
    } catch (Exception e) {
      getLogger().warn(
        "socket server disconnected, stopping");
    }
  }
463191
def postActivate_(self):
        
        self.analyzer = LicensePlateDetector(**self.analyzer_pars) # this is called after the fork (i.e. after the multiprocess has been spawned)
        self.report("analyzer object=", self.analyzer)
265813
private function ensureProcessIsStarted(): void
    {
        if (is_resource($this->process) === false) {
            $this->startProcess();

            $this->handleStartupErrors();
        }
    }
1130279
public function start()
    {
        if (0 !== $this->oid) {
            throw new StatusError('The context has already been started.');
        }

        list($parent, $child) = Stream\pair();

        switch ($pid = pcntl_fork()) {
            case -1: // Failure
                throw new ForkException('Could not fork process!');

            case 0: // Child
                // @codeCoverageIgnoreStart

                // Create a new event loop in the fork.
                Loop\loop($loop = Loop\create(false));

                $channel = new ChannelledStream($pipe = new DuplexPipe($parent));
                fclose($child);

                $coroutine = new Coroutine($this->execute($channel));
                $coroutine->done();

                try {
                    $loop->run();
                    $code = 0;
                } catch (\Throwable $exception) {
                    $code = 1;
                }

                $pipe->close();

                exit($code);

                // @codeCoverageIgnoreEnd

            default: // Parent
                $this->pid = $pid;
                $this->oid = posix_getpid();
                $this->channel = new ChannelledStream($this->pipe = new DuplexPipe($child));
                fclose($parent);
        }
    }
1314458
def _post_process(self):
        
        self._process = None
        shutil.move(self._temp_capture_file_path, self._capture_file_path)
716734
def reopen_after_fork!
#       logger.debug { "#{self.class}##{__method__}" }

      unless @state == :paused
        raise InvalidStateError, "state should have been :paused, not: #{@state.inspect}"
      end

      if @thread 
        raise InvalidStateError, "WTF?! did you fork in a callback? my thread was alive!" if @thread.alive?
        @thread = nil
      end

      @mutex  = Mutex.new
      @cond   = ConditionVariable.new
      @array  = []
      resume_after_fork_in_parent
    end
164450
def run_at_subprocess(self, use_subprocess, foo, *args, **kwrags):
        
        if use_subprocess is False:
            return foo(*args, **kwrags)

        child_pid = os.fork()
        if child_pid == 0:
            foo(*args, **kwrags)
            sys.exit(0)
        return os.waitpid(child_pid, 0)[1] == 0
1034023
public function runAfter()
    {
        foreach ($this->running as $key => $middleware) {
            /* @var $middleware MiddlewareAbstract */
            $middleware->onAfter();
            unset($this->running[$key]);
        }

        return;
    }
798060
function spawn() {
  if(this.ps && this.ps.connected) return;
  this.ps = fork(
    runner, [], {execPath: path.basename(process.execPath)});
  this.ps.send({event: 'loglevel', level: log.level()});
}