(PECL pthreads >= 2.0.0)
はじめに
ワーカースレッドには永続コンテキストがあり、たいていの場合はスレッドに対して使えます。
ワーカーを開始させると run メソッドを実行しますが、以下のいずれかの条件を満たすまでスレッドは終了しません。
- Worker がスコープから外れる (どこからも参照されなくなる)
- プログラマーが shutdown を呼ぶ
- スクリプトが終了する
つまり、プログラマーは実行中のコンテキストを再利用できるということです。 オブジェクトを Worker のスタックに置くと、そのオブジェクトの run メソッドを Worker が実行します。
クラス概要
Worker extends Thread implements Traversable , Countable , ArrayAccess {
public getStacked ( ) : int
public isShutdown ( ) : bool
public isWorking ( ) : bool
public shutdown ( ) : bool
public unstack ( ) : int
/* 継承したメソッド */
public Thread::detach ( ) : void
public Thread::getCreatorId ( ) : int
public static Thread::getCurrentThread ( ) : Thread
public static Thread::getCurrentThreadId ( ) : int
public Thread::getThreadId ( ) : int
public static Thread::globally ( ) : mixed
public Thread::isJoined ( ) : bool
public Thread::isStarted ( ) : bool
public Thread::join ( ) : bool
public Thread::kill ( ) : void
public Thread::start
([ int $options
] ) : bool
}
目次
- Worker::collect — Collect references to completed tasks
- Worker::getStacked — Gets the remaining stack size
- Worker::isShutdown — State Detection
- Worker::isWorking — 状態を検出する
- Worker::shutdown — Shutdown the worker
- Worker::stack — Stacking work
- Worker::unstack — Unstacking work
/* メソッド */