do the process in background
343662
public function doProcess(){
        $command = 'nohup '.$this->command.' > /dev/null 2>&1 & echo $!';
        exec($command ,$pross);
        $this->pid = (int)$pross[0];
    }
611188
public function start()
    {
        foreach ($this->processes as $process) {
            //start process
            $process->start();

            //update status array
            $this->updateStatus();

            while ($this->runningProcesses() >= $this->concurrent) {
                usleep(self::SLEEP_INTERVAL);
                //update status
                $this->updateStatus();
            }
        }
        //wait until all processes are finished
        $this->wait();
    }
1007089
def before_processing(eng, objects):
        """"""
        super(InvenioProcessingFactory, InvenioProcessingFactory)\
            .before_processing(eng, objects)
        eng.save(WorkflowStatus.RUNNING)
        db.session.commit()
1097246
def run(self):
        
        self._stop = False
        while not self._stop:
            have_sources = self._timers or self._readers or self._writers
            if not self._processor.pending and not have_sources:
                break
            events = QEventLoop.AllEvents
            if not self._processor.pending:
                events |= QEventLoop.WaitForMoreEvents
            self._qapp.processEvents(events)
            if self._processor.pending:
                self._processor.run()
1055580
def act(self):
        
        g = get_root(self).globals
        g.clog.debug('Stop pressed')

        # Stop exposure meter
        # do this first, so timer doesn't also try to enable idle mode
        g.info.timer.stop()

        def stop_in_background():
            try:
                self.stopping = True
                if execCommand(g, 'abort'):
                    self.stopped_ok = True
                else:
                    g.clog.warn('Failed to stop run')
                    self.stopped_ok = False
                self.stopping = False
            except Exception as err:
                g.clog.warn('Failed to stop run. Error = ' + str(err))
                self.stopping = False
                self.stopped_ok = False

        # stopping can take a while during which the GUI freezes so run in
        # background.
        t = threading.Thread(target=stop_in_background)
        t.daemon = True
        t.start()
        self.after(500, self.check)
1207751
def _set_process_async(process):
    """"""
    for fd in [process.stderr.fileno(), process.stdout.fileno()]:
        fl = fcntl.fcntl(fd, fcntl.F_GETFL)
        fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
892806
public function childProcessCommand(): void
    {
        $ret = ProcessUtil::create(function ($pid) {
            echo "print in process $pid";

            sleep(5);
        });

        if ($ret === false) {
            $this->output->liteError('current env is not support process create.');
        }
    }
193107
def _trigger_event(self, event, *args, **kwargs):
        """"""
        run_async = kwargs.pop('run_async', False)
        if event in self.handlers:
            if run_async:
                return self.start_background_task(self.handlers[event], *args)
            else:
                try:
                    return self.handlers[event](*args)
                except:
                    self.logger.exception(event + ' handler error')
960110
def start(self, use_atexit=True):
        '''
        '''
        assert not self._process

        _logger.debug('Starting process %s', self._proc_args)

        process_future = asyncio.create_subprocess_exec(
            stdin=subprocess.PIPE,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            *self._proc_args
        )
        self._process = yield from process_future

        self._stderr_reader = asyncio.async(self._read_stderr())
        self._stdout_reader = asyncio.async(self._read_stdout())

        if use_atexit:
            atexit.register(self.close)
1138283
def wait_process(self):
        """"""
        self.process.wait()
        if self.analyze_data:
            self.receiving_thread.join()
1035213
function() {
        if(!this._isStopped) {
            return;
        }

        this._isStopped = false;
        var processedBuffer = this._processedBuffer;
        if(processedBuffer.length) {
            this._processedBuffer = [];
            nextTick(function() {
                while(processedBuffer.length) {
                    processedBuffer.shift()();
                }
            });
        }

        this._hasPendingTasks() && this._scheduleRun();
    }
55284
def pause_process(self, key):
        """"""
        if key in self.processes and key not in self.paused:
            os.killpg(os.getpgid(self.processes[key].pid), signal.SIGSTOP)
            self.queue[key]['status'] = 'paused'
            self.paused.append(key)
            return True
        return False
391536
public function maybe_handle() {
		if ( $this->is_process_running() ) {
			// Background process already running.
			wp_die();
		}

		if ( $this->is_queue_empty() ) {
			// No data to process.
			wp_die();
		}

		check_ajax_referer( $this->identifier, 'nonce' );

		$this->handle();

		wp_die();
	}
1234482
public function process()
    {
        switch ($this->inputs['action']) {
            case 'login':
                $this->webLogin();
                break;
            case 'logout':
                $this->webLogout();
                exit($this->showWebLoginForm());
                break;
            case 'getContacts':
                $this->getContacts();
                break;
            case 'updateStatus':
                $this->updateStatus();
                break;
            case 'sendMessage':
                $this->sendMessage();
                break;
            case 'sendBroadcast':
                $this->sendBroadcast();
                break;
            default:
                if (isset($_SESSION['logged_in']) && $_SESSION['logged_in'] == true) {
                    exit($this->showWebForm());
                }
                exit($this->showWebLoginForm());
                break;
        }
    }
1367939
void startProcessInstance(ProcessInstance processInstanceVO, int delay)
      throws ProcessException {

        try {
            Process process = getProcessDefinition(processInstanceVO);
            edao.setProcessInstanceStatus(processInstanceVO.getId(), WorkStatus.STATUS_PENDING_PROCESS);
            // setProcessInstanceStatus will really set to STATUS_IN_PROGRESS - hint to set START_DT as well
            if (logger.isInfoEnabled()) {
                logger.info(logtag(processInstanceVO.getProcessId(), processInstanceVO.getId(),
                        processInstanceVO.getMasterRequestId()),
                        WorkStatus.LOGMSG_PROC_START + " - " + process.getQualifiedName()
                        + (processInstanceVO.isEmbedded() ?
                                (" (embedded process " + process.getId() + ")") :
                                ("/" + process.getVersionString())));
            }
            notifyMonitors(processInstanceVO, WorkStatus.LOGMSG_PROC_START);
            // get start activity ID
            Long startActivityId;
            if (processInstanceVO.isEmbedded()) {
                edao.setProcessInstanceStatus(processInstanceVO.getId(), WorkStatus.STATUS_PENDING_PROCESS);
                startActivityId = process.getStartActivity().getId();
            } else {
                Activity startActivity = process.getStartActivity();
                if (startActivity == null) {
                    throw new ProcessException("Transition has not been defined for START event! ProcessID = " + process.getId());
                }
                startActivityId = startActivity.getId();
            }
            InternalEvent event = InternalEvent.createActivityStartMessage(
                    startActivityId, processInstanceVO.getId(),
                    null, processInstanceVO.getMasterRequestId(),
                    EventType.EVENTNAME_START + ":");
            if (delay > 0) {
                String msgid = ScheduledEvent.INTERNAL_EVENT_PREFIX + processInstanceVO.getId()
                    + "start" + startActivityId;
                this.sendDelayedInternalEvent(event, delay, msgid, false);
            } else sendInternalEvent(event);
        }
        catch (Exception ex) {
            logger.severeException(ex.getMessage(), ex);
            throw new ProcessException(ex.getMessage());
        }
    }
932458
def pause() -> None:
    
    if _logger is not None:
        _log(INFO, "Process", local.name, "pause")
    Process.current().rsim()._gr.switch()
841186
def stop(self):
        """"""
        self._end.value = True
        if self.background_process:
            try:
                self.background_process.terminate()
            except Exception:
                pass
        for task_id, values in self.current_tasks.items():
            try:
                values['proc'].terminate()
            except Exception:
                pass