/**
  * Create new execution context from pool options
  *
  * @param Pool $pool
  */
 public function __construct($pool)
 {
     $this->executionTimeout = $pool->getExecutionTimeout();
     $this->pollTimeout = $pool->getPollTimeout();
     $this->usleepTime = $pool->getSelectUsleepTime();
     $this->isSelectSupported = $pool->isSelectSupported();
     $this->isBlockingMode = $pool->isBlockingModeEnabled();
     $this->isDebugEnabled = $pool->isDebugEnabled();
     foreach ($pool->getCommands() as $command) {
         $this->procs[] = new Process($command);
     }
 }
예제 #2
0
 public function testOptions()
 {
     $pool = new Pool('some command', ['SomeUserOption' => 'Value']);
     $this->assertEquals($pool->getOption('SomeUserOption'), 'Value');
     $pool = new Pool('some command', [Pool::OPTION_EXECUTION_TIMEOUT => 2000]);
     $this->assertEquals($pool->getExecutionTimeout(), 2000);
     $pool->setExecutionTimeout(4000);
     $this->assertEquals($pool->getExecutionTimeout(), 4000);
     $this->assertEquals($pool->getOption(Pool::OPTION_EXECUTION_TIMEOUT), 4000);
 }