flix

0.67.2

BPlusTree.AtomicCounter

enum AtomicCounter[_: Eff]Source
case AtomicCounter(java.util.concurrent.atomic.LongAdder)

A thread-safe counter producing Int32.

A LongAdder is used as AtomicInteger/AtomicLong appeared to perform badly under high contention.

Definitions

def get(counter: AtomicCounter[r]): Int32 \ r Source

Returns the current state of counter.

def increment(counter: AtomicCounter[r]): Unit \ r Source

Increments counter by 1.

def mkCounter(_: Region[r], initialValue: Int32): AtomicCounter[r] \ r Source

Returns a fresh counter with initialized to initialVal.