Added documentation for Thread->registerClassLoader() and Worker->registerClassLoader()

This commit is contained in:
Dylan K. Taylor 2017-07-22 10:55:00 +01:00
parent 1a7f567a70
commit 6fa59230db
2 changed files with 14 additions and 0 deletions

View File

@ -43,6 +43,13 @@ abstract class Thread extends \Thread{
$this->classLoader = $loader;
}
/**
* Registers the class loader for this thread.
*
* WARNING: This method MUST be called from any descendent threads' run() method to make autoloading usable.
* If you do not do this, you will not be able to use new classes that were not loaded when the thread was started
* (unless you are using a custom autoloader).
*/
public function registerClassLoader(){
if(!interface_exists("ClassLoader", false)){
require(\pocketmine\PATH . "src/spl/ClassLoader.php");

View File

@ -44,6 +44,13 @@ abstract class Worker extends \Worker{
$this->classLoader = $loader;
}
/**
* Registers the class loader for this thread.
*
* WARNING: This method MUST be called from any descendent threads' run() method to make autoloading usable.
* If you do not do this, you will not be able to use new classes that were not loaded when the thread was started
* (unless you are using a custom autoloader).
*/
public function registerClassLoader(){
if(!interface_exists("ClassLoader", false)){
require(\pocketmine\PATH . "src/spl/ClassLoader.php");