Skip to main content

FORCE_LOCK

Static FORCE_LOCK 

Source
static FORCE_LOCK: AtomicU8
Expand description

Raw spinlock for _print_force to prevent multi-core character interleaving. Uses a ticket-style test-and-set: 0 = free, 1 = locked.

Interrupt safety: force_lock_acquire saves and disables IRQs before spinning, and force_lock_release restores them. This prevents a nested timer IRQ on the same CPU from trying to acquire FORCE_LOCK while it is already held by an outer serial_force_println! call, which would deadlock.