Skip to content

Preserve reentrant lock state after invalid release - #1112

Open
OskarEichler wants to merge 2 commits into
ruby-concurrency:masterfrom
OskarEichler:codex/reentrant-release-state
Open

OskarEichler wants to merge 2 commits into
ruby-concurrency:masterfrom
OskarEichler:codex/reentrant-release-state

Conversation

@OskarEichler

Copy link
Copy Markdown
Contributor

Checks read/write ownership before decrementing the thread-local hold count. Invalid releases still raise, but no longer wrap the counter and poison later valid lock operations.

Verified by focused reentrant lock specs and models; the review composite passes 2,796 examples with no failures.

@bensheldon bensheldon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this be tested?

@OskarEichler

Copy link
Copy Markdown
Contributor Author

Yes. I added regression coverage for both read and write releases. Each test first performs an invalid release, verifies IllegalOperationError, and then acquires and releases the same lock successfully; before this fix, the invalid release mutated the per-thread held count and the later acquire failed. The focused lock spec passes: 41 examples, 0 failures.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants