pocketmine\scheduler\ServerScheduler::scheduleAsyncTask PHP Method

scheduleAsyncTask() public method

Submits an asynchronous task to the Worker Pool
public scheduleAsyncTask ( AsyncTask $task ) : void
$task AsyncTask
return void
    public function scheduleAsyncTask(AsyncTask $task)
    {
        $id = $this->nextId();
        $task->setTaskId($id);
        $this->asyncPool->submitTask($task);
    }

Usage Example

Example #1
0
 public function sendUsage($type = SendUsageTask::TYPE_STATUS)
 {
     $this->scheduler->scheduleAsyncTask(new SendUsageTask($this, $type, $this->uniquePlayers));
     $this->uniquePlayers = [];
 }
All Usage Examples Of pocketmine\scheduler\ServerScheduler::scheduleAsyncTask