SERIAL

Static SERIAL 

Source
static SERIAL: SpinLock<Serial>
Expand description

A global serial device protected by a spinlock.

This static instance of Serial ensures safe concurrent access to the serial port. It is wrapped in a SpinLock to provide mutual exclusion, preventing race conditions when multiple threads attempt to write to or read from the serial device.

The Serial struct typically represents a UART (Universal Asynchronous Receiver-Transmitter) device used for debugging, logging, or kernel output.

ยงSafety

  • Accessing this global requires acquiring the spinlock before modifying the serial state.
  • Since SpinLock is used instead of Mutex, it should only be used in environments without preemption, such as kernel mode, to avoid deadlocks.