-
Notifications
You must be signed in to change notification settings - Fork 95
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
Expose weak versions of CAS methods #150
Conversation
Useful when using `spin` to implement higher-level sync primitives. Signed-off-by: Klim Tsoutsman <klim@tsoutsman.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, these changes look good to me. Just a few minor comments. I'm happy to expose this API though.
Signed-off-by: Klim Tsoutsman <klim@tsoutsman.com>
Signed-off-by: Klim Tsoutsman <klim@tsoutsman.com>
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, |
* Recent upstream changes exposed the `try_lock_weak()` function in `spin`'s `Mutex`, allowing us to use it in our implementation. * See <mvdnes/spin-rs#150> Signed-off-by: Klim Tsoutsman <klim@tsoutsman.com>
* Recent upstream changes exposed the `try_lock_weak()` function in `spin`'s `Mutex`, allowing us to use it in our implementation. * See <mvdnes/spin-rs#150> Signed-off-by: Klim Tsoutsman <klim@tsoutsman.com> 8e9638d
…s-os#935) * Recent upstream changes exposed the `try_lock_weak()` function in `spin`'s `Mutex`, allowing us to use it in our implementation. * See <mvdnes/spin-rs#150> Signed-off-by: Klim Tsoutsman <klim@tsoutsman.com> 8e9638d
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.