[PATCH RFC] rust: maple_tree: implement Send and Sync for MapleTree

Joel Fernandes joelagnelf at nvidia.com
Mon Apr 20 16:42:25 PDT 2026



On 4/20/2026 6:00 PM, Daniel Almeida wrote:
> Hi Joel,
> 
> I think there are others in a better position to review this than me, 
> however, while reading this patch, I noticed this:
>>
>>     #[inline]
>> @@ -302,19 +305,31 @@ fn drop(mut self: Pin<&mut Self>) {
>>     }
>> }
>>
>> +// SAFETY: `MapleTree<T>` is `Send` iff `T` is `Send`.  All access to the tree
>> +// goes through the internal `ma_lock` spinlock or via `&mut MapleTree`.
>> +unsafe impl<T: ForeignOwnable + Send> Send for MapleTree<T> {}
>> +// SAFETY: All shared access through `&MapleTree` either acquires `ma_lock`.
> 
> ^ Missing something here? Either … or? 
> 
Yes, it should be either acquires `ma_lock` or uses &mut. I will adjust it.

thanks,

--
Joel Fernandes




More information about the maple-tree mailing list