This commit is contained in:
2023-07-20 15:01:24 +08:00
parent 221183e196
commit 0b1be47fb6
+4 -1
View File
@@ -52,6 +52,9 @@ class PoolItem
*/ */
public function push(mixed $item): void public function push(mixed $item): void
{ {
if (is_null($item)) {
$item = call_user_func($this->callback);
}
$this->_items->push($item); $this->_items->push($item);
} }
@@ -109,7 +112,7 @@ class PoolItem
if ($this->_items->isEmpty()) { if ($this->_items->isEmpty()) {
return call_user_func($this->callback); return call_user_func($this->callback);
} else { } else {
return $this->_items->pop(); return $this->_items->pop($waite);
} }
} }
} }