pht\AtomicInteger::unlock
(PECL pht >= 0.0.1)
pht\AtomicInteger::unlock — Releases the atomic integer's mutex lock
説明
public pht\AtomicInteger::unlock ( ) : void
This method will release the mutex lock associated with the atomic integer.
パラメータ
この関数にはパラメータはありません。
返り値
No return value.
例
例1 Grouping together an atomic integer's operations (requiring a mutex lock)
<?phpuse pht\AtomicInteger;$atomicInteger = new AtomicInteger(2);// assumes $atomicInteger is being used by multiple threads$atomicInteger->lock();$atomicInteger->set($atomicInteger->get() * 2); // double the value$atomicInteger->unlock();var_dump($atomicInteger->get());
上の例の出力は以下となります。
int(4)