当前位置: 首页>>代码示例>>PHP>>正文


PHP Process::start方法代码示例

本文整理汇总了PHP中Process::start方法的典型用法代码示例。如果您正苦于以下问题:PHP Process::start方法的具体用法?PHP Process::start怎么用?PHP Process::start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Process的用法示例。


在下文中一共展示了Process::start方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: start

 /**
  * Asynchronously start mediainfo operation.
  * Make call to MediaInfoCommandRunner::wait() afterwards to receive output.
  */
 public function start()
 {
     $this->processBuilder->add($this->filePath);
     $this->processAsync = $this->processBuilder->getProcess();
     // just takes advantage of symfony's underlying Process framework
     // process runs in background
     $this->processAsync->start();
 }
开发者ID:petrofcz,项目名称:php-mediainfo,代码行数:12,代码来源:MediaInfoCommandRunner.php

示例2: execute

 /**
  * add a process
  *
  * @param Process $process
  * @param null|string $name process name
  * @return int
  */
 public function execute(Process $process, $name = null)
 {
     if (!is_null($name)) {
         $process->name($name);
     }
     $process->start();
     return array_push($this->processes, $process);
 }
开发者ID:asuper114,项目名称:simple-fork-php,代码行数:15,代码来源:Pool.php

示例3: start

 /**
  * {@inheritdoc}
  */
 public function start($callback = null)
 {
     if (null === $this->getCommandLine()) {
         if (false === ($php = $this->executableFinder->find())) {
             throw new \RuntimeException('Unable to find the PHP executable.');
         }
         $this->setCommandLine($php);
     }
     parent::start($callback);
 }
开发者ID:joan16v,项目名称:symfony2_test,代码行数:13,代码来源:PhpProcess.php

示例4: tick

 /**
  * start new processes if needed
  *
  * @return int num of job
  */
 public function tick()
 {
     if ($this->countPool() < 1 && $this->countJob()) {
         $job = $this->getJob();
         if ($job) {
             $szal = new Process($this->worker);
             $szal->setLifeTime(4);
             //NOTICE
             $this->pool[] = $szal;
             $szal->start($job);
         }
     }
     return $this->countJob();
 }
开发者ID:shaogx,项目名称:easyJob,代码行数:19,代码来源:Queue.php

示例5: reload

 /**
  * start the same number processes and kill the old sub process
  * just like nginx -s reload
  * this method will block until all the old process exit;
  *
  * @param bool $block
  */
 public function reload($block = true)
 {
     $old_process = $this->processes;
     for ($i = 0; $i < $this->max; $i++) {
         $process = new Process($this->runnable);
         $process->start();
         $this->processes[$process->getPid()] = $process;
     }
     foreach ($old_process as $process) {
         $process->shutdown();
         $process->wait($block);
         unset($this->processes[$process->getPid()]);
     }
 }
开发者ID:asuper114,项目名称:simple-fork-php,代码行数:21,代码来源:ParallelPool.php

示例6: startBudabot

 /**
  * Starts Budabot instance.
  * Calling this more than once has no effect unless the bot is not running.
  */
 public static function startBudabot()
 {
     if (self::$botProcess) {
         return;
     }
     // delete old DB-file if it exists
     @unlink(ROOT_PATH . '/data/' . self::$vars['DB Name']);
     if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
         $phpExec = realpath(ROOT_PATH . "\\win32\\php.exe") . " -c php-win.ini";
     } else {
         $phpExec = "php";
     }
     // start budabot instance
     $process = new Process();
     $process->setCommand("{$phpExec} -f tests/helpers/test_main.php");
     $path = self::$parameters['budabot_log'];
     if (is_string($path)) {
         $file = fopen($path, 'w');
         $process->setDescriptorspec(array(1 => $file, 2 => $file));
     } else {
         if ($path) {
             $process->setDescriptorspec(array());
         } else {
             $process->setDescriptorspec(array(1 => array('file', 'nul', 'w'), 2 => array('file', 'nul', 'w')));
         }
     }
     $process->setWorkingDir(ROOT_PATH);
     if (!$process->start()) {
         throw new Exception("Failed to start Budabot!");
     }
     // make sure that the bot instance is terminated on exit
     register_shutdown_function(function () use($process) {
         $process->stop();
     });
     self::$botProcess = $process;
 }
开发者ID:jibinam,项目名称:budabot2,代码行数:40,代码来源:ContextHelpers.php

示例7: spawn

 /**
  * fork process with job
  *
  * @return
  */
 public function spawn()
 {
     $worker = $this->ready();
     $ident = $this->getIdent($worker);
     //use Process
     $p = new Process($worker);
     $p->start();
     $pid = $p->getPid();
     if ($pid) {
         $this->childPool[$ident][$pid] = $pid;
     }
     // //@TODO
     // $pid = pcntl_fork();
     // if ($pid == -1) {
     // } elseif ($pid) {
     //     $this->childPool[$ident][$pid] = $pid;
     // } else {
     //     //@TODO
     //     //$this->setOwner($name = 'www');
     //     //$this->setTitle($title);
     //     $this->childPool[$ident] = [];
     //     //$cid = getmypid();
     //     //echo "\ngetmypid={$cid}\n";
     //     // 这个符号表示恢复系统对信号的默认处理
     //     pcntl_signal(SIGTERM, SIG_DFL);
     //     pcntl_signal(SIGCHLD, SIG_DFL);
     //     call_user_func_array($worker, array());
     //     //call_user_func_array($worker);
     //     exit(0);
     // }
 }
开发者ID:shaogx,项目名称:easyJob,代码行数:36,代码来源:Worker.php

示例8: start

 /**
  * start the pool
  */
 public function start()
 {
     $alive_count = $this->aliveCount();
     // create sub process and run
     if ($alive_count < $this->max) {
         $need = $this->max - $alive_count;
         for ($i = 0; $i < $need; $i++) {
             $process = new Process($this->runnable);
             $process->start();
             $this->processes[$process->getPid()] = $process;
         }
     }
 }
开发者ID:huyanping,项目名称:simple-fork-php,代码行数:16,代码来源:ParallelPool.php

示例9: __construct

    public $counter;
    public function __construct()
    {
        $this->counter = 0;
    }
    public function run()
    {
    }
}
class Process extends Worker
{
    private $text = "";
    public function __construct($text, $object)
    {
        $this->text = $text;
        $this->object = $object;
    }
    public function run()
    {
        while ($this->object->counter < 10) {
            print $this->object->counter++ . " - {$this->text}\n";
            sleep(1);
        }
    }
}
$foo = new Foo();
$a = new Process("A", $foo);
$a->start();
$b = new Process("B", $foo);
$b->start();
开发者ID:silentred,项目名称:learning-path,代码行数:30,代码来源:pthreads-test.php

示例10: generate_password

 public static function generate_password()
 {
     global $vncpwd;
     Process::start('php', $vncpwd, false);
 }
开发者ID:jacobwgillespie,项目名称:archive,代码行数:5,代码来源:service.class.php


注:本文中的Process::start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。