The AtomicInteger class

(PECL pht >= 0.0.1)


The pht\AtomicInteger class is currently the only supported atomic value. It allows for an integer to be safely passed around between, and manipulated, by multiple threads. The methods exposed by this class do not need mutex locking, since they will acquire the internal mutex lock implicitly. pht\AtomicInteger::lock() and pht\AtomicInteger::unlock() are still exposed, however, for when multiple operations involving the same pht\AtomicInteger object need to be grouped together.

The mutex locks of the atomic values are reentrant safe.

Class synopsis

pht\AtomicInteger implements pht\Threaded {
/* Methods */
public AtomicInteger __construct ([ int $value = 0 ] )
public void dec ( void )
public int get ( void )
public void inc ( void )
public void lock ( void )
public void set ( int $value )
public void unlock ( void )

Table of Contents

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top