Record nonblocking one-shot guard acquisitions and report whether a later attempt was blocked.

Atomic Guard Coordination Report

AtomicGuardCoordinationReport.kt
import java.util.concurrent.atomic.AtomicBoolean

fun main() {
    val holds = 
    val guard = AtomicBoolean(false)
    var acquired = 0
    var blocked = 0

    for (i in 0 until holds) {
        if (guard.compareAndSet(false, true)) {
            acquired++
        } else {
            blocked++
        }
    }

    val status = if (acquired == 0) {
        "idle"
    } else if (blocked > 0) {
        "blocked"
    } else {
        "guarded"
    }

    println("holds=$holds acquired=$acquired blocked=$blocked $status")
}
import java.util.concurrent.atomic.AtomicBoolean

fun main() {
    val holds = 
    val guard = AtomicBoolean(false)
    var acquired = 0
    var blocked = 0

    for (i in 0 until holds) {
        if (guard.compareAndSet(false, true)) {
            acquired++
        } else {
            blocked++
        }
    }

    val status = if (acquired == 0) {
        "idle"
    } else if (blocked > 0) {
        "blocked"
    } else {
        "guarded"
    }

    println("holds=$holds acquired=$acquired blocked=$blocked $status")
}
import java.util.concurrent.atomic.AtomicBoolean

fun main() {
    val holds = 
    val guard = AtomicBoolean(false)
    var acquired = 0
    var blocked = 0

    for (i in 0 until holds) {
        if (guard.compareAndSet(false, true)) {
            acquired++
        } else {
            blocked++
        }
    }

    val status = if (acquired == 0) {
        "idle"
    } else if (blocked > 0) {
        "blocked"
    } else {
        "guarded"
    }

    println("holds=$holds acquired=$acquired blocked=$blocked $status")
}
compare-and-set guard A coordination report records nonblocking acquire attempts. An `java.util.concurrent.atomic.AtomicBoolean` started at false models an exclusive one-shot guard, and `compareAndSet(false, true)` returns true only for the attempt that flips the flag, so it never blocks. The first acquire flips the flag, so a later attempt in the same run reads true and is reported as blocked. The status line summarizes whether the section stayed idle, guarded, or blocked a later acquire.