doc: add non-atomicity comment to emit_status RMW (argus note)
This commit is contained in:
parent
fce1f49f6a
commit
252d8bf9af
1 changed files with 9 additions and 0 deletions
|
|
@ -762,6 +762,15 @@ impl Bus {
|
|||
// statuses that shouldn't touch it (e.g. `needs_login_in_progress`
|
||||
// is a transient mid-flow status; only `needs_login_idle` and
|
||||
// `online` should change the persistent flag).
|
||||
//
|
||||
// Known non-atomicity: this is a read-modify-write. Two concurrent
|
||||
// `emit_status` calls could clobber each other's `needs_login`
|
||||
// change if they raced between the read and the write. In practice
|
||||
// this is safe: the turn loop is sequential and the login flow
|
||||
// (`needs_login_idle` / `online`) only fires outside of active
|
||||
// turns, so the two callers never overlap. Documented rather than
|
||||
// locked because adding a Mutex here would be overkill for the
|
||||
// actual call pattern.
|
||||
let (_, current_needs_login) = read_harness_state();
|
||||
let new_needs_login = if status == "needs_login_idle" {
|
||||
true
|
||||
|
|
|
|||
Loading…
Reference in a new issue