PHP
处理控制 | Process Control

Threaded (class)

The Threaded class

Introduction

(PECL pthreads >= 2.0.0)

Threaded objects form the basis of pthreads ability to execute user code in parallel; they expose synchronization methods and various useful interfaces.

Threaded objects, most importantly, provide implicit safety for the 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 ] )

}

Table of Contents

  • Threaded::chunk — Manipulation

  • Threaded::count — Manipulation

  • Threaded::extend — Runtime Manipulation

  • Threaded::from — Creation

  • Threaded::getTerminationInfo — Error Detection

  • Threaded::isRunning — State Detection

  • Threaded::isTerminated — State Detection

  • Threaded::isWaiting — State Detection

  • Threaded::lock — Synchronization

  • Threaded::merge — Manipulation

  • Threaded::notify — Synchronization

  • Threaded::notifyOne — Synchronization

  • Threaded::pop — Manipulation

  • Threaded::shift — Manipulation

  • Threaded::synchronized — Synchronization

  • Threaded::unlock — Synchronization

  • Threaded::wait — Synchronization

← Predefined Constants

Threaded::chunk →

© 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

https://secure.php.net/manual/en/class.threaded.php