mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Worked on scheduler
This commit is contained in:
@ -26,24 +26,20 @@ use pocketmine\Server;
|
||||
/**
|
||||
* Class used to run async tasks in other threads.
|
||||
*
|
||||
* WARNING: Do not call PocketMine-MP API methods from other Threads!!
|
||||
* WARNING: Do not call PocketMine-MP API methods, or save objects from/on other Threads!!
|
||||
*/
|
||||
abstract class AsyncTask extends \Threaded{
|
||||
abstract class AsyncTask extends \Collectable{
|
||||
|
||||
protected $complete = null;
|
||||
protected $finished = null;
|
||||
protected $result = null;
|
||||
protected $taskId = null;
|
||||
private $finished = null;
|
||||
private $result = null;
|
||||
private $taskId = null;
|
||||
|
||||
public function run(){
|
||||
$this->finished = false;
|
||||
$this->complete = false;
|
||||
$this->result = null;
|
||||
|
||||
$this->onRun();
|
||||
|
||||
$this->finished = true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,17 +49,6 @@ abstract class AsyncTask extends \Threaded{
|
||||
return $this->finished === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isCompleted(){
|
||||
return $this->complete === true;
|
||||
}
|
||||
|
||||
public function setCompleted(){
|
||||
$this->complete = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
|
Reference in New Issue
Block a user