pthreads Thread::isJoined
(PECL pthreads >= 2.0.0)
Thread::isJoined — State Detection
설명
public Thread::isJoined(): bool
참조된 스레드가 조인되었는지 여부를 알려줍니다.
매개변수
이 함수에는 매개변수가 없습니다.
반환 값
성공하면 true
를, 실패하면 false
를 반환합니다.
Examples
예제 #1 참조된 스레드의 상태 감지
<?php
class My extends Thread {
public function run() {
$this->synchronized(function($thread){
if (!$thread->done)
$thread->wait();
}, $this);
}
}
$my = new My();
$my->start();
var_dump($my->isJoined());
$my->synchronized(function($thread){
$thread->done = true;
$thread->notify();
}, $my);
?>
위의 예는 다음을 출력합니다.
bool(false)