Expand description
Raw spin lock without guard, specifically designed for Global Allocator integration
This module provides a spin lock implementation that integrates with lock_api::RawMutex
for use with the talc allocator’s Talck type.
§Key Differences from RawSpinLock
- Implements
lock_api::RawMutextrait - Does not return a Guard from
lock()method - Stores interrupt state internally using
AtomicUsize - Unlock operation restores the interrupt state
§Interrupt Safety
This lock provides interrupt protection to prevent deadlocks when:
- A thread holds the allocator lock
- An interrupt occurs on the same CPU
- The interrupt handler tries to allocate memory
Without interrupt protection, this would cause a deadlock.
Structs§
- RawSpin
Lock Without Guard - 自旋锁结构体,不返回 Guard,集成了中断状态保存与恢复功能。