Improve documentation of Thread and Worker

This commit is contained in:
Dylan K. Taylor
2021-09-10 15:57:45 +01:00
parent 32588d79c8
commit f5c9c02e09
2 changed files with 16 additions and 2 deletions

View File

@ -26,7 +26,14 @@ namespace pocketmine\thread;
use const PTHREADS_INHERIT_NONE;
/**
* This class must be extended by all custom threading classes
* Specialized Worker class for PocketMine-MP-related use cases. It handles setting up autoloading and error handling.
*
* Workers are a special type of thread which execute tasks passed to them during their lifetime. Since creating a new
* thread has a high resource cost, workers can be kept around and reused for lots of short-lived tasks.
*
* As a plugin developer, you'll rarely (if ever) actually need to use this class directly.
* If you want to run tasks on other CPU cores, check out AsyncTask first.
* @see AsyncTask
*/
abstract class Worker extends \Worker{
use CommonThreadPartsTrait;