[PATCH 2/3] rust: maple_tree: add MapleTree::lock() and load()
Boqun Feng
boqun.feng at gmail.com
Mon Jul 28 08:19:25 PDT 2025
On Sat, Jul 26, 2025 at 01:23:23PM +0000, Alice Ryhl wrote:
[...]
> +/// A reference to a [`MapleTree`] that owns the inner lock.
> +///
> +/// # Invariants
> +///
> +/// This guard owns the inner spinlock.
> +pub struct MapleLock<'tree, T: ForeignOwnable>(&'tree MapleTree<T>);
So it's a guard, how about we name it `MapleGuard`, or `MapleLockGuard`,
or just `Guard`?
Regards,
Boqun
> +
> +impl<'tree, T: ForeignOwnable> Drop for MapleLock<'tree, T> {
> + #[inline]
> + fn drop(&mut self) {
> + // SAFETY: By the type invariants, we hold this spinlock.
> + unsafe { bindings::spin_unlock(self.0.ma_lock()) };
> + }
> +}
> +
[...]
More information about the maple-tree
mailing list