Thread::globally
(PECL pthreads >= 2.0.1)
Thread::globally — Execution
Description
Will execute a Callable in the global scope
Parameters
This function has no parameters.
Return Values
The return value of the Callable
Examples
Example #1 Execute in the global scope
<?php
class My extends Thread {
public function run() {
global $std;
Thread::globally(function(){
$std = new stdClass;
});
var_dump($std);
}
}
$my = new My();
$my->start();
?>
The above example will output:
object(stdClass)#3 (0) { }
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Расширения для управления процессами программ
- pthreads
- Функция Thread::detach() - Execution
- Функция Thread::getCreatorId() - Identification
- Функция Thread::getCurrentThread() - Identification
- Функция Thread::getCurrentThreadId() - Identification
- Функция Thread::getThreadId() - Identification
- Функция Thread::globally() - Execution
- Функция Thread::isJoined() - State Detection
- Функция Thread::isStarted() - State Detection
- Функция Thread::join() - Synchronization
- Функция Thread::kill() - Execution
- Функция Thread::start() - Execution
Коментарии
"This function has no parameters" and "void" in description, but in example unnamed function passed. Looks like parameter not "void", but "callable".