Answer the question
In order to leave comments, you need to log in
Why does calling class methods in a thread not see other classes?
I wanted to run 2 functions in a thread, connected pthreads, followed the example
. I created 2 handler classes (workers), I call them, add them to the pool and call them.
$pool = new Pool(2, 'Worker');
$pool->submit(new Thread($worker1));
$pool->submit(new Thread($worker2));
while ($pool->collect(function ($work) {
return $work->isGarbage();
})) continue;
$pool->shutdown();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question