GoLang pht\AtomicInteger::unlock

request it (366)
GoLang replacement for PHP's pht\AtomicInteger::unlock [edit | history]



Do you know a GoLang replacement for PHP's pht\AtomicInteger::unlock? Write it!

PHP pht\AtomicInteger::unlock

PHP original manual for pht\AtomicInteger::unlock [ show | php.net ]

pht\AtomicInteger::unlock

(PECL pht >= 0.0.1)

pht\AtomicInteger::unlockReleases the atomic integer's mutex lock

Description

public void pht\AtomicInteger::unlock ( void )

This method will release the mutex lock associated with the atomic integer.

Parameters

This function has no parameters.

Return Values

No return value.

Examples

Example #1 Grouping together an atomic integer's operations (requiring a mutex lock)

<?php

use 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());

The above example will output:

int(4)