file: concurrent.aus

class: AtomicBool

[106:14] (extern: com.aussom.stdlib.AAtomicBool) extends: object

Atomic boolean. The main use is the one-shot guard: many threads race compareAndSet(false, true) and exactly one wins. Each method call is atomic; a sequence of method calls is not.

Methods

class: Semaphore

[315:14] (extern: com.aussom.stdlib.ASemaphore) extends: object

Counting semaphore for throttling: at most N concurrent holders of a resource. There is deliberately no timeout-free acquire so a script cannot park a host worker thread forever; tryAcquire(0) is the non-blocking form. Each method call is atomic; a sequence of method calls is not.

Methods

class: Counter

[204:14] (extern: com.aussom.stdlib.ACounter) extends: object

Striped counter built for write contention. Where AtomicLong retries when many threads hammer it, Counter stripes writes across cells and sums on read. The default choice for metrics and hit counters. Trade-offs: no compareAndSet, and sum() is not a point-in-time snapshot while writers are active. Each method call is atomic; a sequence of method calls is not.

Methods

class: BlockingQueue

[249:14] (extern: com.aussom.stdlib.ABlockingQueue) extends: object

Thread-safe FIFO queue with optional capacity and blocking operations. The bridge between threads: many producers offer() work items and one dedicated worker take()s them, owning any non-thread-safe resources. A bounded queue gives backpressure. Values cross threads safely through the queue; treat a handed-off mutable value as given away. null cannot be queued because null is poll()'s empty return. take() and put() block the calling thread, so request handlers should prefer offer()/poll() with timeouts and leave indefinite blocking to dedicated threads.

Methods

class: Lock

[398:14] (extern: com.aussom.stdlib.ALock) extends: object

Scoped mutual exclusion. The escape hatch for multi-step updates that no single atomic method covers. There is deliberately no separate lock()/unlock() pair: a script exception between the two would leak the lock forever, so the only way to hold the lock is withLock, where acquire, run, and guaranteed release happen inside one call. Prefer the atomic classes above when one of them fits; two locks taken in different orders by different threads can still deadlock (the wait timeout turns that into a visible error instead of a frozen thread).

Methods

class: AtomicLong

[41:14] (extern: com.aussom.stdlib.AAtomicLong) extends: object

Atomic 64-bit integer. The workhorse for IDs and low-contention counters. For metrics counters hammered by many writer threads, prefer Counter. Each method call is atomic; a sequence of method calls is not.

Methods

class: Latch

[355:14] (extern: com.aussom.stdlib.ALatch) extends: object

One-shot countdown gate. One thread waits until N events have happened: N workers finished, N messages arrived. The count cannot be reset; create a new Latch for a new round. await always takes a timeout so a script cannot park a host worker thread forever.

Methods

class: AtomicRef

[154:14] (extern: com.aussom.stdlib.AAtomicRef) extends: object

Atomic reference holding any Aussom value. The use case is whole-value publication: build a new map or list, then set() it in one step so readers see the old value or the new one, never a mix. Each method call is atomic; a sequence of method calls is not.

Methods