Re: [PATCH v2 3/5] rust: maple_tree: add MapleTree::lock() and load()
From: Danilo Krummrich
Date: Tue Aug 19 2025 - 07:39:59 EST
On Tue Aug 19, 2025 at 12:34 PM CEST, Alice Ryhl wrote:
> To load a value, one must be careful to hold the lock while accessing
> it. To enable this, we add a lock() method so that you can perform
> operations on the value before the spinlock is released.
>
> This adds a MapleGuard type without using the existing SpinLock type.
> This ensures that the MapleGuard type is not unnecessarily large, and
> that it is easy to swap out the type of lock in case the C maple tree is
> changed to use a different kind of lock.
>
> Co-developed-by: Andrew Ballance <andrewjballance@xxxxxxxxx>
> Signed-off-by: Andrew Ballance <andrewjballance@xxxxxxxxx>
> Reviewed-by: Andrew Ballance <andrewjballance@xxxxxxxxx>
> Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
Without the unwrap() calls in the examples,
Reviewed-by: Danilo Krummrich <dakr@xxxxxxxxxx>