首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

Thread (class)

Introduction

(PECL pthreads >= 2.0.0)

When the start method of a Thread is invoked, the run method code will be executed in separate Thread, in parallel.

After the run method is executed the Thread will exit immediately, it will be joined with the creating Thread at the appropriate time.

Warning

Relying on the engine to determine when a Thread should join may cause undesirable behaviour; the programmer should be explicit, where possible.

Class synopsis

Thread extends Threaded implements Countable , Traversable , ArrayAccess {

/* Methods */

代码语言:javascript
复制
public void detach ( void )
代码语言:javascript
复制
public integer getCreatorId ( void )
代码语言:javascript
复制
public static Thread getCurrentThread ( void )
代码语言:javascript
复制
public static integer getCurrentThreadId ( void )
代码语言:javascript
复制
public integer getThreadId ( void )
代码语言:javascript
复制
public static mixed globally ( void )
代码语言:javascript
复制
public boolean isJoined ( void )
代码语言:javascript
复制
public boolean isStarted ( void )
代码语言:javascript
复制
public boolean join ( void )
代码语言:javascript
复制
public void kill ( void )
代码语言:javascript
复制
public boolean start ([ integer $options ] )

/* Inherited methods */

代码语言:javascript
复制
public array Threaded::chunk ( integer $size , boolean $preserve )
代码语言:javascript
复制
public integer Threaded::count ( void )
代码语言:javascript
复制
public bool Threaded::extend ( string $class )
代码语言:javascript
复制
public Threaded Threaded::from ( Closure $run [, Closure $construct [, array $args ]] )
代码语言:javascript
复制
public array Threaded::getTerminationInfo ( void )
代码语言:javascript
复制
public boolean Threaded::isRunning ( void )
代码语言:javascript
复制
public boolean Threaded::isTerminated ( void )
代码语言:javascript
复制
public boolean Threaded::isWaiting ( void )
代码语言:javascript
复制
public boolean Threaded::lock ( void )
代码语言:javascript
复制
public boolean Threaded::merge ( mixed $from [, bool $overwrite ] )
代码语言:javascript
复制
public boolean Threaded::notify ( void )
代码语言:javascript
复制
public boolean Threaded::notifyOne ( void )
代码语言:javascript
复制
public boolean Threaded::pop ( void )
代码语言:javascript
复制
public void Threaded::run ( void )
代码语言:javascript
复制
public mixed Threaded::shift ( void )
代码语言:javascript
复制
public mixed Threaded::synchronized ( Closure $block [, mixed $... ] )
代码语言:javascript
复制
public boolean Threaded::unlock ( void )
代码语言:javascript
复制
public boolean Threaded::wait ([ integer $timeout ] )

}

Table of Contents

  • Thread::detach — Execution
  • Thread::getCreatorId — Identification
  • Thread::getCurrentThread — Identification
  • Thread::getCurrentThreadId — Identification
  • Thread::getThreadId — Identification
  • Thread::globally — Execution
  • Thread::isJoined — State Detection
  • Thread::isStarted — State Detection
  • Thread::join — Synchronization
  • Thread::kill — Execution
  • Thread::start — Execution

← Threaded::wait

Thread::detach →

代码语言:txt
复制
 ? 1997–2017 The PHP Documentation Group

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

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com