Closed
Description
Some places in the task code are commented with "only one task should ever do this". Now that we have unsafe global variables, we can implement a safe convenience macro that can assert this at runtime instead of at comment-time.
It should expand to something like:
unsafe {
static mut __gensymed__thing_already_happened: bool = false;
// "double-check locking" to avoid doing an xchg all the time
if __gensymed__thing_already_happened == false {
if atomic_xchg(&mut __gensymed__thing_already_happened, true, Relaxed) == true {
fail!($provided_message);
}
}
}