Atomic Operations

Atomics allow you to perform guaranteed atomic operations on buffers. This is useful for example when you want to write to the same buffer index from multiple threads at the same time. Without atomics, the result would be undefined.

Atomics support:

  • atomic<int>
  • atomic<uint>

Example

Reference

struct atomic
Properties
__type: T
__value: number
$mutate: ((to: value) => void) | undefined
Methods
load( ) -> T
store( value: T ) -> void
max( value: T ) -> T
min( value: T ) -> T
xor( value: T ) -> T
exchange( value: T ) -> T
compareExchangeWeak( compare: T,value: T ) -> { old_value: T; exchanged: boolean; }
atomic < T > ( value: T ) -> atomic<T>