Skip to content

Redundant AtomicCell Error Signaling #57

@d3v-null

Description

@d3v-null

Several modules in the codebase use an AtomicCell<bool> as an error flag to signal errors between threads (e.g., let error = AtomicCell::new(false);). Each thread sets error.store(true) on error, and other threads check if error.load() to decide whether to exit early. This pattern is used in addition to channels for inter-thread communication.

  • src/params/peel/mod.rs
  • src/params/vis_convert.rs
  • src/params/vis_subtract.rs
  • src/params/di_calibration.rs
  • src/params/vis_simulate.rs
  • src/cli/vis_utils/simulate/mod.rs

In all these cases, threads are already communicating via channels. If a thread encounters an error and exits, it will close its end of the channel, and other threads will receive a SendError or RecvError and can exit cleanly.
The explicit AtomicCell is redundant and adds unnecessary complexity. Relying on channel closure is more idiomatic and robust in Rust.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions