Skip to content

Commit

Permalink
Update Thread.php
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTechsTech committed Apr 15, 2022
1 parent d2dbcc5 commit 9f2272f
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions Spawn/Thread.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,22 +149,13 @@ public function create($tid, callable $task, ...$args): self
*/
public function join($tid = null): void
{
if (!empty($tid))
while ($this->isRunning($tid)) {
if ($this->hasLoop) {
$this->loop->run();
} else {
\uv_run(self::$uv, \UV::RUN_ONCE);
}
}
else
while (!$this->isEmpty()) {
if ($this->hasLoop) {
$this->loop->run();
} else {
\uv_run(self::$uv, \UV::RUN_NOWAIT);
}
while (!empty($tid) ? $this->isRunning($tid) : !$this->isEmpty()) {
if ($this->hasLoop) {
$this->loop->run($tid);
} else {
\uv_run(self::$uv, !empty($tid) ? \UV::RUN_ONCE : \UV::RUN_NOWAIT);
}
}
}

/**
Expand Down

0 comments on commit 9f2272f

Please sign in to comment.