PHP Class pocketmine\scheduler\AsyncTask

WARNING: Do not call PocketMine-MP API methods, or save objects from/on other Threads!!
Inheritance: extends Collectable
Show file Open project: iTXTech/Genisys Class Usage Examples

Public Properties

Property Type Description
$worker AsyncWorker

Public Methods

Method Description
cancelRun ( )
cleanObject ( )
getFromThreadStore ( string $identifier ) : mixed Gets something into the local thread store.
getResult ( ) : mixed
getTaskId ( )
hasCancelledRun ( )
hasResult ( ) : boolean
isCrashed ( )
isFinished ( ) : boolean
isGarbage ( ) : boolean
onCompletion ( Server $server ) : void Actions to execute when completed (on main thread) Implement this if you want to handle the data in your AsyncTask after it has been processed
onRun ( ) : void Actions to execute when run
run ( )
saveToThreadStore ( string $identifier, mixed $value ) Saves something into the local thread store.
setGarbage ( )
setResult ( mixed $result, boolean $serialize = true )
setTaskId ( $taskId )

Method Details

cancelRun() public method

public cancelRun ( )

cleanObject() public method

public cleanObject ( )

getFromThreadStore() public method

You have to initialize this in some way from the task on run
public getFromThreadStore ( string $identifier ) : mixed
$identifier string
return mixed

getResult() public method

public getResult ( ) : mixed
return mixed

getTaskId() public method

public getTaskId ( )

hasCancelledRun() public method

public hasCancelledRun ( )

hasResult() public method

public hasResult ( ) : boolean
return boolean

isCrashed() public method

public isCrashed ( )

isFinished() public method

public isFinished ( ) : boolean
return boolean

isGarbage() public method

public isGarbage ( ) : boolean
return boolean

onCompletion() public method

Actions to execute when completed (on main thread) Implement this if you want to handle the data in your AsyncTask after it has been processed
public onCompletion ( Server $server ) : void
$server pocketmine\Server
return void

onRun() abstract public method

Actions to execute when run
abstract public onRun ( ) : void
return void

run() public method

public run ( )

saveToThreadStore() public method

This might get deleted at any moment.
public saveToThreadStore ( string $identifier, mixed $value )
$identifier string
$value mixed

setGarbage() public method

public setGarbage ( )

setResult() public method

public setResult ( mixed $result, boolean $serialize = true )
$result mixed
$serialize boolean

setTaskId() public method

public setTaskId ( $taskId )

Property Details

$worker public property

public AsyncWorker,pocketmine\scheduler $worker
return AsyncWorker