API Reference › Sync › Sync.atomic
method

Sync.atomic

Sync.atomic() -> int

Create an atomic counter (starts at 0).

Returns an atomic-counter handle. Read it with Sync.get, write with Sync.set, accumulate with Sync.add, and swap conditionally with Sync.cas.

Example

let a = Sync.atomic()
← All symbols