Atomics

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since December 2021.

* Some parts of this feature may have varying levels of support.

Atomics 객체는 아토믹 연산(Atomic operation, 원자적 연산)을 정적 메서드로 제공합니다. SharedArrayBufferArrayBuffer 객체와 함께 사용됩니다.

설명

아토믹 연산은 Atomic 모듈에 설치됩니다. 다른 전역 객체와 달리 Atomics는 생성자가 아니기 때문에, new 연산자와 함께 사용하거나 Atomics 객체를 함수로 호출할 수 없습니다. Math 객체처럼 Atomics의 모든 속성과 메서드는 정적입니다.

아토믹 연산

메모리가 공유되면 여러 스레드가 메모리에서 동일한 데이터를 읽고 쓸 수 있습니다. 아토믹 연산은 예측 가능한 값을 쓰고 읽고, 다음 연산이 시작되기 전에 연산을 완료하여 연산이 중단되지 않도록 합니다.