GenisysPro  for Minecraft PE/Windows 10 v1.1.x
Feature-rich server software for Minecraft PE and Windows 10 Edition
Worker Class Reference

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()

collect ( callable  $function)

Collects finished objects

Parameters
callable$functionvoid
372 {}

◆ collector()

collector ( Collectable  $collectable)
336 {}

◆ getStacked()

getStacked ( )

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

int An integral value

326 {}

◆ isShutdown()

isShutdown ( )

Tell if the referenced Worker has been shutdown

bool A boolean indication of state

334 {}

◆ shutdown()

shutdown ( )

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

bool A boolean indication of success

344 {}

◆ stack()

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

354 {}

◆ unstack()

unstack ( )

Removes the first item from the stack

int The new length of the stack

362 {}

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