PocketMine
AsyncTask Class Reference
Inheritance diagram for AsyncTask:
ChunkRequestTask GenerationTask GeneratorRegisterTask GeneratorUnregisterTask LightPopulationTask PopulationTask CompressBatchedTask FileWriteTask GarbageCollectionTask SendUsageTask

Public Member Functions

 run ()
 
 isFinished ()
 
 getResult ()
 
 cancelRun ()
 
 hasCancelledRun ()
 
 hasResult ()
 
 setResult ($result, $serialize=true)
 
 setTaskId ($taskId)
 
 getTaskId ()
 
 getFromThreadStore ($identifier)
 
 saveToThreadStore ($identifier, $value)
 
 onRun ()
 
 onCompletion (Server $server)
 
 cleanObject ()
 

Data Fields

 $worker = null
 

Detailed Description

Class used to run async tasks in other threads.

WARNING: Do not call PocketMine-MP API methods, or save objects from/on other Threads!!

Member Function Documentation

getFromThreadStore (   $identifier)

Gets something into the local thread store. You have to initialize this in some way from the task on run

Parameters
string$identifier
Returns
mixed
getResult ( )
Returns
mixed
hasResult ( )
Returns
bool
isFinished ( )
Deprecated:
Returns
bool
onCompletion ( Server  $server)

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

Parameters
Server$server
Returns
void
onRun ( )
abstract

Actions to execute when run

Returns
void
saveToThreadStore (   $identifier,
  $value 
)

Saves something into the local thread store. This might get deleted at any moment.

Parameters
string$identifier
mixed$value
setResult (   $result,
  $serialize = true 
)
Parameters
mixed$result
bool$serialize

The documentation for this class was generated from the following file: