Genisys  Genisys API 1.9.3
A server software for Minecraft: Pocket Edition with many features
Worker Class Reference
Inheritance diagram for Worker:
[legend]
Collaboration diagram for Worker:
[legend]

Public Member Functions

 getStacked ()
 
 isShutdown ()
 
 collector (Collectable $collectable)
 
 shutdown ()
 
 stack (Collectable &$work)
 
 unstack ()
 
 collect (callable $function)
 
- Public Member Functions inherited from Thread
 getCreatorId ()
 
 getThreadId ()
 
 isJoined ()
 
 isStarted ()
 
 join ()
 
 start (int $options=PTHREADS_INHERIT_ALL)
 
- Public Member Functions inherited from Threaded
 chunk ($size, bool $preserve=false)
 
 count ()
 
 isRunning ()
 
 isTerminated ()
 
 merge ($from, $overwrite=true)
 
 notify ()
 
 notifyOne ()
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetExists ($offset)
 
 offsetUnset ($offset)
 
 pop ()
 
 run ()
 
 shift ()
 
 synchronized (\Closure $function, $args=null)
 
 wait ($timeout)
 
 getRefCount ()
 
 addRef ()
 
 delRef ()
 
 isGarbage ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Thread
static getCurrentThread ()
 
static getCurrentThreadId ()
 
- Static Public Member Functions inherited from Threaded
static extend ($obj)
 

Detailed Description

Worker

Worker Threads have a persistent context, as such should be used over Threads in most cases.

When a Worker is started, the run method will be executed, but the Thread will not leave until one of the following conditions are met:

  • the Worker goes out of scope (no more references remain)
  • the programmer calls shutdown
  • the script dies This means the programmer can reuse the context throughout execution; placing objects on the stack of the Worker will cause the Worker to execute the stacked objects run method.

http://www.php.net/manual/en/class.worker.php

Member Function Documentation

collect ( callable  $function)

Collects finished objects

Parameters
callable$functionvoid
getStacked ( )

Returns the number of threaded tasks waiting to be executed by the referenced Worker

int An integral value

isShutdown ( )

Tell if the referenced Worker has been shutdown

bool A boolean indication of state

shutdown ( )

Shuts down the Worker after executing all the threaded tasks previously stacked

bool A boolean indication of success

stack ( Collectable $work)

Appends the referenced object to the stack of the referenced Worker

Parameters
Collectable$workCollectable object to be executed by the referenced Worker

int The new length of the stack

unstack ( )

Removes the first item from the stack

int The new length of the stack


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