What is the $thread- > done of php multithreaded pthread?

the pause code is as follows:

$this->synchronized(function($thread){
    if (!$thread->done)
        $thread->wait();
}, $this);

the wake-up code is as follows:

$my->synchronized(function($thread){
    $thread->done = true;
    $thread->notify();
}, $my);

then. What on earth is that thread- > done? Why does it still work when I get rid of the program?
Please all bosses to give us some advice.

Mar.15,2021

here done is a common field, which is actually the same as the following, which is the basic usage of PHP:

class A {
}

$a = new A();
$a->done = true;

Run

your complete code should be an example in pthread:

<?php
class My extends Thread {
    public function run() {
        $this->synchronized(function($thread){
            if (!$thread->done)
                $thread->wait();
        }, $this);
    }
}
$my = new My();
$my->start();
$my->synchronized(function($thread){
    $thread->done = true;
    $thread->notify();
}, $my);
var_dump($my->join());

start () starts running run () in the child thread, which is done has not yet been assigned, so wait () will be executed. The main thread then executes notofy () to wake up the child threads that are wait () .

another case is that the main thread first assigns and executes notify () to done , and then executes run () to the child thread. At this time, the child thread does not need wait , because the main thread is already notify () .

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b358b6-4ec08.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b358b6-4ec08.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?