This commit is contained in:
2021-03-29 17:47:13 +08:00
parent ec101543c9
commit 442386866d
7 changed files with 44 additions and 46 deletions
+5 -3
View File
@@ -76,14 +76,16 @@ class Channel extends Component
* @return mixed
* @throws Exception
*/
public function pop(int|float $timeout, string $name, Closure $closure, int $length = 100): mixed
public function pop(string $name, Closure $closure, int|float $timeout = null, int $length = 999): mixed
{
if (($channel = $this->channelInit($length, $name)) == false) {
return $this->addError('Channel is full.');
}
$data = null;
if (!$channel->isEmpty()) {
return $channel->pop();
}
$data = null;
if ($timeout !== null) {
$data = $channel->pop($timeout);
}
if (empty($data)) {