The Volatile classはじめにThe Volatile class is new to pthreads v3. Its introduction is a consequence of the new immutability semantics of Threaded members of Threaded classes. The Volatile class enables for mutability of its Threaded members, and is also used to store PHP arrays in Threaded contexts. クラス概要Volatile
class Volatile
extends
Threaded
implements
Collectable, Traversable {
/* 継承したメソッド */
public array Threaded::chunk(int
$size , bool $preserve )public int Threaded::count()
public bool Threaded::extend(string
$class )public bool Threaded::isRunning()
public bool Threaded::isTerminated()
public bool Threaded::merge(mixed
$from , bool $overwrite = ?)public bool Threaded::notify()
public bool Threaded::notifyOne()
public bool Threaded::pop()
public void Threaded::run()
public mixed Threaded::shift()
public mixed Threaded::synchronized(Closure
$block , mixed ...$args )public bool Threaded::wait(int
}$timeout = ?)例例1 New immutability semantics of Threaded
上の例の出力は、 たとえば以下のようになります。 RuntimeException: Threaded members previously set to Threaded objects are immutable, cannot overwrite data in %s:%d 例2 Volatile use-case
上の例の出力は、 たとえば以下のようになります。 object(stdClass)#3 (0) { } |