ndk-glue: Switch to parking_lot for mappable and Sendable lock guards#282
Conversation
31e7175 to
130d013
Compare
|
I mentioned in #285 that we can Is that something we want to do or have hard feelings against? We never cared much about MSRV and I wouldn't even know where this crate (the chain of these crates) are at right now. If we do, we should at least test the MSRV that we set in the CI and specify it in EDIT: In case it isn't clear, I don't think we should bump MSRV purely to drop a few |
130d013 to
22aabab
Compare
22aabab to
4db6021
Compare
…guards It has come up previously that the `native_window()` function is easier to use if we could transpose a `LockGuard<Option<>>` into an `Option<LockGuard<>>`. After all, as soon as you have the lock you only need to check the `Option<>` value once and are thereafter guaranteed that its value won't change, until the lock is given up. At the same time `parking_lot` has a `send_guard` feature which allows moving a lock guard to another thread (as long as `deadlock_detection` is disabled); a use case for this recently came up [in glutin] where the `NativeWindow` handle lock should be stored with a GL context so that our `fn on_window_destroyed()` callback doesn't return until after the `Surface` created on it is removed from the context and destroyed. Glutin forces this context to be `Send`, and a lock guard already allows `Sync` if `NativeWindow` is `Sync` (which it is). [in glutin]: rust-windowing/glutin#1411 (comment)
4db6021 to
286674b
Compare
Depends on #282
It has come up previously that the
native_window()function is easier to use if we could transpose aLockGuard<Option<>>into anOption<LockGuard<>>. After all, as soon as you have the lock you only need to check theOption<>value once and are thereafter guaranteed that its value won't change, until the lock is given up.At the same time
parking_lothas asend_guardfeature which allows moving a lock guard to another thread (as long asdeadlock_detectionis disabled); a use case for this recently came up in glutin where theNativeWindowhandle lock should be stored with a GL context so that ourfn on_window_destroyed()callback doesn't return until after theSurfacecreated on it is removed from the context and destroyed. Glutin forces this context to beSend, and a lock guard already allowsSyncifNativeWindowisSync(which it is).