Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 17792 программиста и 1601 робот. Сейчас ищут 1237 программистов ...
Приступая к работе

The Worker class

Вернуться к: pthreads

(PECL pthreads >= 2.0.0)

Введение

Worker Threads have a persistent context, as such should be used over Threads in most cases.

When a Worker is started, the run method will be executed, but the Thread will not leave until one of the following conditions are met:

  • the Worker goes out of scope (no more references remain)

  • the programmer calls shutdown

  • the script dies

This means the programmer can reuse the context throughout execution; placing objects on the stack of the Worker will cause the Worker to execute the stacked objects run method.

Внимание

The programmer must retain references to stacked objects until they are executed or unstacked; the Pool class provides a higher level abstraction of the Worker functionality and manages references for the programmer.

Обзор классов

Worker extends Thread implements Traversable , Countable , ArrayAccess {
/* Методы */
public integer getStacked ( void )
public boolean isShutdown ( void )
public boolean isWorking ( void )
public boolean shutdown ( void )
public integer stack ( Threaded &$work )
public integer unstack ([ Threaded &$work ] )
/* Наследуемые методы */
public void Thread::detach ( void )
public integer Thread::getCreatorId ( void )
public static Thread Thread::getCurrentThread ( void )
public static integer Thread::getCurrentThreadId ( void )
public integer Thread::getThreadId ( void )
public static mixed Thread::globally ( void )
public boolean Thread::isJoined ( void )
public boolean Thread::isStarted ( void )
public boolean Thread::join ( void )
public void Thread::kill ( void )
public boolean Thread::start ([ integer $options ] )
}

Содержание



Вернуться к: pthreads

© 2024 «PHP.RU — Сообщество PHP-Программистов»
Главная | Форум | Реклама на сайте | Контакты VIP Сувениры
Разработка компании ODware