Jenner\SimpleFork\Process::wait PHP Метод

wait() публичный Метод

waiting for the sub process exit
public wait ( boolean | true $block = true, integer $sleep = 100000 )
$block boolean | true if block the process
$sleep integer default 0.1s check sub process status every $sleep milliseconds.
    public function wait($block = true, $sleep = 100000)
    {
        while (true) {
            if ($this->isRunning() === false) {
                return;
            }
            if (!$block) {
                break;
            }
            usleep($sleep);
        }
    }

Usage Example

Пример #1
0
 public function testWait()
 {
     $this->process_thread->start();
     $this->process_thread->wait();
     $this->assertEquals(0, $this->process_thread->exitCode());
     $this->assertEquals(0, $this->process_thread->errno());
     $this->process_runable->start();
     $this->process_runable->wait();
     $this->assertEquals(0, $this->process_runable->exitCode());
     $this->assertEquals(0, $this->process_runable->errno());
     $this->process_callback->start();
     $this->process_callback->wait();
     $this->assertEquals(0, $this->process_callback->exitCode());
     $this->assertEquals(0, $this->process_callback->errno());
 }
All Usage Examples Of Jenner\SimpleFork\Process::wait