php8.5
Home/ Manual/ swoole / atomic/ Swoole\Atomic::cmpset

Swoole\Atomic::cmpset

PHP function Edit on GitHub ✎

(PECL swoole >= 1.9.0)

Compare and set the value of the atomic object.

Description

Swoole\Atomic::cmpset(int $cmp_value, int $new_value): int

Parameters

cmp_value

The value to compare with the current value of the atomic object.

new_value

The value to set to the atomic object if the cmp_value is the same as the current value of the atomic object.

Return Values

The new value of the atomic object.

Source: reference/swoole/swoole/atomic/cmpset.xml · from the official PHP manual (php/doc-en)