Closed tsoutsman closed 1 year ago
Are you looking to see a new release with this feature?
It would be nice but not critical. We're happy to just use a patch manifest section.
Sorry, I'm currently implementing our blocking spin lock and noticed there isn't a way to access the reader count from the guard.
Ideally, force_read_decrement
would return the previous count so that we know when no readers are left. However, this would be a breaking change and require exposing rw_lock::READER
, which is an implementation detail, so I think it may be better if we forked spin
rather than upstreaming that change, considering how niche our use case is and how many dependents spin
has.
Hi,
I'm working on implementing sync primitives in Theseus OS on top of spin locks. We currently have to implement our own spin lock that is identical to
spin
except that it exposestry_lock_weak
, so that we can have customlock
implementations that use a weak CMPXCHG, while still using a strong CMPXCHG fortry_lock
.It would be nice if we could upstream this so that we could directly depend on
spin
. I think it makes sense to include it asspin
is often used to build higher-level primitives which could use a weak CMPXCHG for better performance.