mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
This commit is contained in:
@ -29,22 +29,18 @@ use pocketmine\Server;
|
||||
*/
|
||||
abstract class AsyncTask extends \Threaded{
|
||||
|
||||
private $complete = null;
|
||||
private $finished = null;
|
||||
private $result = null;
|
||||
public $complete = null;
|
||||
public $finished = null;
|
||||
public $result = null;
|
||||
|
||||
public function run(){
|
||||
$this->lock();
|
||||
$this->finished = false;
|
||||
$this->complete = false;
|
||||
$this->result = null;
|
||||
$this->unlock();
|
||||
|
||||
$this->onRun();
|
||||
|
||||
$this->lock();
|
||||
$this->finished = true;
|
||||
$this->unlock();
|
||||
|
||||
}
|
||||
|
||||
@ -52,7 +48,6 @@ abstract class AsyncTask extends \Threaded{
|
||||
* @return bool
|
||||
*/
|
||||
public function isFinished(){
|
||||
|
||||
return $this->finished === true;
|
||||
}
|
||||
|
||||
@ -88,6 +83,14 @@ abstract class AsyncTask extends \Threaded{
|
||||
$this->result = @serialize($result);
|
||||
}
|
||||
|
||||
public function setTaskId($taskId){
|
||||
$this->taskId = $taskId;
|
||||
}
|
||||
|
||||
public function getTaskId(){
|
||||
return $this->taskId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Actions to execute when run
|
||||
*
|
||||
|
Reference in New Issue
Block a user