Skip to content

Conversation

datdenkikniet
Copy link
Contributor

@datdenkikniet datdenkikniet commented Mar 10, 2025

loom is a tool that can be used to validate concurrent programs exhaustively.

This PR adds support for loom to the std implementation of critical-section, with the loom-suggested approach of using a cfg for it. It raises the MSRV of this project to 1.73 when --cfg loom is specified, but otherwise does not affect it.

An example use-case for finding problems using loom can be found here. It uses the same critical section implementation as is provided here. Without it, loom assumes that there are no synchronization/interruption points when a critical section starts or ends. With loom, it runs all the concurrent permutations, and allowed us to repro (though we should've been using loom preventatively) a concurrency bug.

@datdenkikniet datdenkikniet requested a review from a team as a code owner March 10, 2025 12:50
@datdenkikniet datdenkikniet force-pushed the loom branch 3 times, most recently from ef4fc42 to 580ef08 Compare March 10, 2025 13:14
Copy link
Contributor

@therealprof therealprof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely, thanks a lot!

@therealprof therealprof added this pull request to the merge queue Jul 29, 2025
Merged via the queue into rust-embedded:main with commit bc0d173 Jul 29, 2025
9 checks passed
@datdenkikniet datdenkikniet deleted the loom branch August 18, 2025 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants