rust-embedded / heapless

Heapless, `static` friendly data structures
Apache License 2.0
1.52k stars 181 forks source link

MpMcQueue drop implementation is not optimized #489

Open sosthene-nitrokey opened 3 months ago

sosthene-nitrokey commented 3 months ago

The MpMcQueue  drop implementation is not optimized, as it uses the normal dequeue method, which assumes a shared reference and prevents race condition. drop gives us a mutable reference, which means that the implementation could skip the atomic operations, and all the care for synchronization.

See https://github.com/rust-embedded/heapless/pull/483#discussion_r1657140475