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

Fix RwLock fallback implementation #33

Closed
seritools opened this issue Jul 13, 2024 · 4 comments
Closed

Fix RwLock fallback implementation #33

seritools opened this issue Jul 13, 2024 · 4 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@seritools
Copy link
Member

seritools commented Jul 13, 2024

An RwLock fallback implementatoin cannot be done with a mutex, as it prevents multiple read locks e.g. from the same thread to happen, or prevents co-dependent threads that all should have read locks from progressing together. In fact, even the simple example in the Rust std docs for RwLock will panic immediately.

Split off from #32 (comment)

Interesting links:

@seritools seritools added bug Something isn't working help wanted Extra attention is needed labels Jul 13, 2024
@seritools
Copy link
Member Author

seritools commented Jul 13, 2024

This one might be very easy to vendor in: https://github.com/cmnord/pflock nvm, does not suspend threads when waiting

@seritools seritools changed the title Create better RwLock implementation Fix RwLock fallback implementation Jul 13, 2024
@seritools
Copy link
Member Author

@seritools
Copy link
Member Author

Newer Rust versions have their own SRWLOCK-like implementation that doesn't rely on OS primitives beyond a thread parker implementation. We can bring back the old generic thread parker implementation (as already done in the 1.76 rust9x version) and enable a proper RwLock impl that way 🚀

@seritools seritools self-assigned this Nov 18, 2024
@seritools seritools added enhancement New feature or request and removed help wanted Extra attention is needed labels Nov 21, 2024
@seritools
Copy link
Member Author

Fixed on the 1.84 branch (in development)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant