PHP 8.6.0 Beta 1 is available for testing

Класс Threaded

(PECL pthreads >= 2.0.0)

Введение

Объекты Threaded формируют базис способности pthreads запускать пользовательский код в новых потоках. Класс содержит методы синхронизации и различные полезные интерфейсы.

Самое важное, что объекты Threaded обеспечивают безопасность для разработчика. Все операции в контексте объекта - безопасны.

Обзор класса

class Threaded implements Collectable , Traversable , Countable , ArrayAccess {
/* Методы */
public function chunk (int $size, bool $preserve): array
public function count (): int
public function extend (string $class): bool
public function isRunning (): bool
public function isTerminated (): bool
public function merge (mixed $from, bool $overwrite = ?): bool
public function notify (): bool
public function notifyOne (): bool
public function pop (): bool
public function run (): void
public function shift (): mixed
public function synchronized (Closure $block, mixed ...$args): mixed
public function wait (int $timeout = ?): bool
}

Содержание

Нашли ошибку?

ИнструкцияИсправлениеСообщение об ошибке
+Добавить

Примечания пользователей 2 notes

up
6
derkontrollfreak+php at gmail dot com
11 years ago
> Threaded objects, most importantly, provide implicit safety for the programmer; all operations on the object scope are safe.
However, this comes with a trade-off: Operations on the instance scope are slower than on plain PHP objects.
Static properties are not affected as they are thread-local.
up
2
jtbibliomania at gmail dot com
7 years ago
It's worth mentioning here that, since v2.0.0, 'Stackable' class was an alias for 'Threaded' class but has been removed since.
+Добавить

AltStyle によって変換されたページ (->オリジナル) /