pht\Thread::addClassTask
Class threading
&reftitle.description;
public voidpht\Thread::addClassTask
stringclassName
mixedctorArgs
Adds a new class task to a pht\Threads internal task queue.
&reftitle.parameters;
className
The name of the class to be threaded. This class must implement the
pht\Runnable interface.
ctorArgs
An optional list of arguments for the threaded class' constructor. These
arguments will be serialised (since they are being passed to another
thread).
&reftitle.returnvalues;
No return value.
&reftitle.examples;
Adding a new class task to a thread
one = $one;
}
public function run()
{
var_dump($this->one);
}
}
$thread = new Thread();
$thread->addClassTask(Task::class, 1);
$thread->start();
$thread->join();
]]>
&example.outputs;