Skip to content

solve_all_boards_n threading issue

@tameware

Description

@tameware

library/src/solve_board.cpp

Cursor reports:

The solve_all_boards_n function uses std::memory_order_relaxed for the first_error atomic variable. On weakly-ordered memory architectures (like ARM/Apple Silicon), one thread setting an error may not be visible to other threads checking the error due to lack of acquire-release semantics. This allows threads to continue solving boards after an error has already occurred in another thread, violating the intended behavior of stopping all work on first error.

I can submit a PR with Cursor's proposed fix. I'm raising the issue first since I have no idea what this code is doing! I have not looked at the DD algorithms at all.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions