rust9x / rust

Empowering everyone to build reliable and efficient software, even for Windows 9x/Me/NT/2000/XP/Vista.
https://github.com/rust9x/rust/wiki
Other
332 stars 10 forks source link

Fix RwLock fallback implementation #33

Open seritools opened 1 month ago

seritools commented 1 month ago

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 https://github.com/rust9x/rust/issues/32#issuecomment-2226911009

Interesting links:

seritools commented 1 month ago

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