• PHP Video Tutorials

PHP - Threaded Functions


Advertisements

The Threaded class

The Threaded objects form the basis of pthreads ability to execute user code in parallel. They can expose synchronization methods and various interfaces.

Threaded objects can provide implicit safety for a programmer. All operations on the object scope are safe.

Class synopsis

Threaded implements Collectable , Traversable , Countable , ArrayAccess {
   
   /* Methods */
   public array chunk( integer $size , boolean $preserve )
   public integer count( void )
   public bool extend( string $class )
   public Threaded from( Closure $run [, Closure $construct [, array $args ]] )
   public array getTerminationInfo( void )
   public boolean isRunning( void )
   public boolean isTerminated( void )
   public boolean isWaiting( void )
   public boolean lock( void )
   public boolean merge( mixed $from [, bool $overwrite ] )
   public boolean notify( void )
   public boolean notifyOne( void )
   public boolean pop( void )
   public void run( void )
   public mixed shift( void )
   public mixed synchronized( Closure $block [, mixed $... ] )
   public boolean unlock( void )
   public boolean wait([ integer $timeout ] )
}
Sr.No Function & Description
1

Threaded::chunk()

Function can fetch a chunk of objects property table of a given size, optionally preserving keys.

2

Threaded::count()

Function can return the number of properties for this object, and doesn't have any parameters.

3

Threaded::extend()

Function can make a thread-safe standard class at runtime.

4

Threaded::from()

Function can create an anonymous Threaded object from closures.

5

Threaded::getTerminationInfo()

Function can retrieve terminal error information from a referenced object.

6

Threaded::isRunning()

Function can tell if a referenced object is executing.

7

Threaded::isTerminated

Function tell if a referenced object is terminated during execution, suffered fatal errors, or throw uncaught exceptions.

8

Threaded::isWaiting()

Function can tell if a referenced object is waiting for the notification.

9

Threaded::lock()

Function can lock a referenced objects property table.

10

Threaded::merge

Function can merge the data into a current object.

11

Threaded::notify()

Function can send a notification to referenced object.

12

Threaded::notifyOne()

Function can send a notification to referenced object.

13

Threaded::pop()

Function can pop an item from objects property table.

14

Threaded::run()

Function can always implement a run method for objects that are intended for execution.

15

Threaded::shift()

Function can shift an item from the objects property table.

16

Threaded::synchronized()

Function can return a value from the block.

17

Threaded::unlock()

Function can unlock the referenced objects storage for calling context.

18

Threaded::wait()

Function cause calling context to wait for notification from the referenced object.

php_function_reference.htm

Useful Video Courses


Video

PHP Online Training

45 Lectures 9 hours

Malhar Lathkar

Video

Become PHP Facebook Developer: Password-Less Authentication

34 Lectures 4 hours

Syed Raza

Video

Ultimate PHP & MySQL Web Development Course & OOP Coding

84 Lectures 5.5 hours

Frahaan Hussain

Video

Learn PHP from Scratch

17 Lectures 1 hours

Nivedita Jain

Video

E Commerce Website Development In PHP With PDO

100 Lectures 34 hours

Azaz Patel

Video

PHP in Telugu

43 Lectures 5.5 hours

Vijay Kumar Parvatha Reddy

Advertisements