Skip to content

Commit

Permalink
fixbug
Browse files Browse the repository at this point in the history
  • Loading branch information
kiss291323003 committed Aug 9, 2018
1 parent e78beef commit 7a925f2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Pool/AbstractPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ abstract protected function createObject() ;
public function __construct($maxNum = 10)
{
$this->queue = new \SplQueue();
$this->chan = new Channel();
$this->chan = new Channel(128);
$this->max = $maxNum;
}

Expand Down Expand Up @@ -67,6 +67,10 @@ public function getObj(float $timeout = 0.1)
$key = spl_object_hash($obj);
//标记这个对象已经出队列了
$this->objHash[$key] = true;
//清空channel
while (!$this->queue->isEmpty()){
$this->queue->pop(0.00001);
}
return $obj;
}else{
$this->createdNum--;
Expand Down

0 comments on commit 7a925f2

Please sign in to comment.