mpyw\Co\Internal\Pool::wait PHP 메소드

wait() 공개 메소드

Run curl_multi_exec() loop.
public wait ( )
    public function wait()
    {
        curl_multi_exec($this->mh, $active);
        // Start requests.
        do {
            // if cURL handle is running, use curl_multi_select()
            // otherwise, just sleep until nearest time
            $this->scheduler->isEmpty() ? $this->delayer->sleep() : curl_multi_select($this->mh, $this->options['interval']) < 0 && usleep($this->options['interval'] * 1000000);
            curl_multi_exec($this->mh, $active);
            $this->scheduler->consume();
            $this->delayer->consume();
        } while (!$this->haltException && (!$this->scheduler->isEmpty() || !$this->delayer->isEmpty()));
        if ($this->haltException) {
            throw $this->haltException;
        }
    }

Usage Example

예제 #1
0
파일: PoolTest.php 프로젝트: mpyw/co
 public function testCurlWithoutDeferred()
 {
     $pool = new Pool(new CoOption());
     $pool->addCurl(new DummyCurl('valid', 1));
     $pool->addCurl(new DummyCurl('invalid', 1, true));
     $pool->wait();
     $this->assertTrue(true);
 }
All Usage Examples Of mpyw\Co\Internal\Pool::wait