Re: [PATCH v3 3/4] rust: devres: get rid of Devres' inner Arc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 26, 2025 at 09:47:18PM +0200, Danilo Krummrich wrote:
> On Wed, Jun 25, 2025 at 09:13:24PM -0700, Boqun Feng wrote:
> > On Tue, Jun 24, 2025 at 11:54:01PM +0200, Danilo Krummrich wrote:
> > `T` also need to be `Send` for `Devres<T>` to be `Sync` because that's
> > what `Revocable<T>` requires.
> 
> I think that's because of Revocable::revoke(), however you can't call
> Devres::revoke().

Well, what could happen is we create a `Arc<Devres<T>>` on one thread,
and because it's `Sync`, we can have a clone of it in another thread,
and if that's the last one call `Arc::drop()`, the `Revocable` will be
`revoke()`d in a different thread than it's created.

But with `T` always being `Send`, this is not a problem now.

Regards,
Boqun

> 
> > (Unless we want `T` always being `Send`
> > because of the issue I mentioned above)
> 
> Yes, we do.
> 
> > The rest looks good to me.
> 
> Great! :)




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux