WaitConcurrent
class WaitConcurrent extends Concurrent
Properties
| protected Channel | $channel | from Concurrent | |
| protected WaitGroup | $wg | ||
| protected array<int, true> | $activeCoroutines |
Methods
No description
Proxy isFull() and isEmpty() to the channel.
Wait until a concurrency slot becomes available.
Create a new coroutine with concurrency limiting and wait tracking.
Create a new coroutine with parent context propagation and wait tracking.
Start a coroutine that owns one concurrency slot.
No description
No description
Start a coroutine and track it through deferred cleanup.
Wait for all coroutines to complete.
Cancel active coroutine bodies.
Details
at line 23
__construct(int $limit)
No description
in
Concurrent at line 33
bool
__call(string $name, array $arguments)
Proxy isFull() and isEmpty() to the channel.
in
Concurrent at line 45
int
getLimit()
Get the concurrency limit.
in
Concurrent at line 53
int
getRunningCoroutineCount()
Get the current number of running coroutines.
in
Concurrent at line 64
bool
waitForAvailableSlot(float $timeout = -1)
Wait until a concurrency slot becomes available.
The observed slot is released before this method returns. Another producer may claim it first, in which case create() will wait normally.
at line 33
void
create(callable $callable)
Create a new coroutine with concurrency limiting and wait tracking.
at line 43
void
fork(callable $callable, array $keys = [])
Create a new coroutine with parent context propagation and wait tracking.
in
Concurrent at line 113
protected void
start(callable $callable, array|false $copyContext = false, Closure|null $wrapper = null)
Start a coroutine that owns one concurrency slot.
The optional wrapper runs at native child entry and must invoke the supplied runner exactly once. Outside the runner it must not wait for I/O or other work. Finalize ownership before notifying waiters, which may run immediately.
in
Concurrent at line 149
protected void
acquireSlot()
Acquire one concurrency slot.
at line 16
bool
isFull()
No description
at line 16
bool
isEmpty()
No description
at line 53
protected void
startAndTrack(callable $callable, array|false $copyContext = false)
Start a coroutine and track it through deferred cleanup.
at line 92
bool
wait(float $timeout = -1)
Wait for all coroutines to complete.
at line 108
void
cancel()
Cancel active coroutine bodies.
Completed bodies running deferred cleanup are no longer active and are not interrupted. Each call targets the bodies active at that time.