Skip to main content

Concurrency and streams

Classes and method signatures for Asyncara 0.10.0. Read the usage guide for examples, error handling and resource cleanup. Inherited methods are listed under their declaring class.

Asyncara\Concurrency\Queue​

__construct(int $capacity = 100)
put(mixed $value): void
tryPut(mixed $value): bool
get(): mixed
taskDone(): void
join(): void
count(): int
statistics(): array
close(): void

Asyncara\Concurrency\Lock​

__construct()
acquire(): void
release(): void
synchronized(callable $body): mixed

Asyncara\Concurrency\Semaphore​

__construct(int $permits)
acquire(): void
release(): void
withPermit(callable $body): mixed

Asyncara\Concurrency\Event​

__construct(bool $set = false)
set(): void
reset(): void
isSet(): bool
wait(): void

Asyncara\Stream\AsyncStream​

static fromProducer(callable $producer, int $capacity = 16): Asyncara\Stream\AsyncStream
getIterator(): Traversable
consume(callable $consumer): void
close(): void

Asyncara\Stream\ReadableStream​

consume(callable $consumer): void
close(): void

Asyncara\Stream\Emitter​

__construct(Asyncara\Concurrency\Queue $queue)
emit(mixed $item): void