Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add loom support to std critical section implementation #58

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

datdenkikniet
Copy link

@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
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.

1 participant