AzaThread allows to set the name of the process for child processes (if it is possible). To do this, you need to pass a string with the name as an argument to the thread or to the pool.
$processName = 'worker';
new ExampleThread($processName);
$processName = 'worker';
new ThreadPool($threadClass, $numberOfThreads, $processName);
More information about the AzaThread can be found in the source code - it is well commented and completely covered by the tests. In the tests can be seen more examples of usage.
Also, you can better understand the functioning of AzaThread, enabling debugging. It launches very detailed logging of all that happens. Enable easy - just set the argument $debug
to true
for thread or pool of threads.
$debug = true;
new ExampleThread(null, null, $debug);
$debug = true;
new ThreadPool($threadClass, $numberOfThreads, null, null, $debug);
$debug = true;
$thread = SimpleThread::create(function() {
// ...
}, null, $debug);
If you find a bug or have suggestions to improve AzaThread, please do not hesitate to open the pool requests and issues in the bug tracker.