jamesmunns / bbqueue

A SPSC, lockless, no_std, thread safe, queue, based on BipBuffers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bbq! macro should be unsafe

japaric opened this issue · comments

The documentation says:

this macro is not intrinsically thread safe!

So the macro should be unsafe to call. Also, since this macro is unchecked you may as well directly return &'static mut BBQueue (without the Option).

I would also recommend adding a safe, checked variant that enforces singleton-ness using atomics -- see second snippet in rust-embedded/cortex-m#128 (comment) .

Sounds good! I'll likely add your suggestion to bbq!(), and move the current impl to unsafe bbq_unchecked!() or similar.