Skip to content

Comments

Implement rwlock#144

Merged
arihant2math merged 2 commits intohexagonal-sun:masterfrom
arihant2math:rwlock
Feb 19, 2026
Merged

Implement rwlock#144
arihant2math merged 2 commits intohexagonal-sun:masterfrom
arihant2math:rwlock

Conversation

@arihant2math
Copy link
Collaborator

No description provided.

@arihant2math arihant2math force-pushed the rwlock branch 5 times, most recently from e3c8f6e to 20a6b0a Compare January 15, 2026 17:33
@arihant2math arihant2math force-pushed the rwlock branch 8 times, most recently from ae717d0 to 4755ce4 Compare February 15, 2026 23:42
@arihant2math
Copy link
Collaborator Author

Alright, I've decided to switch to a waiter set to reduce the effect of all the queue rechecking and also to help with the de-registering.

@arihant2math
Copy link
Collaborator Author

I've decided to rewrite this because I noticed a few other unsafe situations, I think it's safer to use mutexes to represent state rather than re-implementing that, for safety reasons.

@arihant2math arihant2math force-pushed the rwlock branch 2 times, most recently from 9a129d2 to 6579d9b Compare February 16, 2026 02:11
@arihant2math arihant2math marked this pull request as ready for review February 16, 2026 02:11
@arihant2math
Copy link
Collaborator Author

Alright, I was able to massively simplify this by implementing internal state as per https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock#Using_two_mutexes. Should have no soundness issues since I'm not even touching atomics here.

Copy link
Owner

@hexagonal-sun hexagonal-sun left a comment

Choose a reason for hiding this comment

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

LGTM, ideally we'd have a bunch of unit tests too, but that can wait.

@arihant2math arihant2math merged commit 600f228 into hexagonal-sun:master Feb 19, 2026
4 checks passed
@arihant2math arihant2math deleted the rwlock branch February 19, 2026 20:51
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