略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: Swoole\Atomic::__construct

2024-12-22

Swoole\Atomic::__construct

(PECL swoole >= 1.9.0)

Swoole\Atomic::__constructConstruct a swoole atomic object.

说明

public Swoole\Atomic::__construct(int $value = ?)

Swoole atomic object is a integer variable allows any processor to atomically test and modify. It is implemented based on CPU atomic instructions. The Swoole atomic variables have to defined before swoole_server->start.

Compare-and-swap (CAS) is an atomic instruction used in multithreading to achieve synchronization. It compares the content of a memory location with a given value and, only if they are the same, modifies the content of that memory location to a new given value.

参数

value

The value of the atomic object.

add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/swoole-atomic.construct.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3