Re: [PATCH v6 03/14] rust: sync: add `Arc::as_ptr`
From: Boqun Feng
Date: Mon Feb 03 2025 - 18:45:40 EST
On Mon, Feb 03, 2025 at 05:46:42PM -0500, Tamir Duberstein wrote:
> On Thu, Jan 16, 2025 at 2:23 PM Andreas Hindborg <a.hindborg@xxxxxxxxxx> wrote:
> >
> > "Tamir Duberstein" <tamird@xxxxxxxxx> writes:
> >
> > > On Fri, Jan 10, 2025 at 3:19 PM Andreas Hindborg <a.hindborg@xxxxxxxxxx> wrote:
> > >>
> > >> Add a method to get a pointer to the data contained in an `Arc`.
> > >>
> > >> Signed-off-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
> > >
> > > Can this mention why it is needed?
> >
> > I can add that after the cut. It is for impleminting `HrTimerPointer`
> > for `Arc`.
>
> The broader question is: why do we need to implement `/HrTimerPointer
> ` for `Arc`? Even broader is: why do we need to use raw pointers so
> much?
Because to use the C function for hrtimer operation (start, cancel,
etc.), we need to pass a raw pointer of "struct hrtimer", which is
embedded in the object in an `Arc`.
Regards,
Boqun