Confusing memory orderings for MAX_LOG_LEVEL_FILTER #453
Labels
No labels
bug
duplicate
easy
enhancement
help wanted
invalid
question
rfc
structured-logging
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-rust-lang/log#453
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Skimming the code for lib.rs, I see the log level is a global atomic:
I'm opening this issue because, as I understand it, the memory orderings used for the store/loads to this variable in this file make no sense:
SeqCst is used for the store:
Relaxed is used for the load:
AIUI, this means the SeqCst store is not synchronizing with any SeqCst loads, so it is useless. Shouldn't the store also be relaxed (To match what I understand are the current semantics being used), or the load be made SeqCst (To change from the current Relaxed semantics to SeqCst)?
I found this PR which favors using SeqCst everywhere except where it's perf-critical, is the (confusing, and seemingly AFAIK useless since it's not synchronizing with any SeqCst load) SeqCst store intended?
The current load/store pairs seem confusing to me because it's not clear if the semantics desired are Relaxed (In which case the SeqCst store should not be there), or SeqCst (In which case there is currently a bug because of the Relaxed load)
I think it makes sense to change the store to relaxed.