-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-concurrencyArea: ConcurrencyArea: ConcurrencyA-syntaxextArea: Syntax extensionsArea: Syntax extensionsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
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);
}
}
}
Metadata
Metadata
Assignees
Labels
A-concurrencyArea: ConcurrencyArea: ConcurrencyA-syntaxextArea: Syntax extensionsArea: Syntax extensionsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.