Hi,

When possible, we should use try-finally.  However, there are cases where
the object can be stored in a cache and it will be released later.  Then,
we cannot use try-finally.

Tsz-Wo



On Thu, Sep 19, 2024 at 7:59 PM ka yuu <[email protected]> wrote:

> Hi ratis commuity!
>
> Can we refer to the idea of RAII to handle ReferenceObject?
>
>
> i.e.:
> * function(ReferenceObject<T> requestRef) {*
> *  ...*
> *  try {*
> *    requestReq.retain();*
> *    ... *
> *  } finaly {*
> *    requestRef.release();*
> *  }*
> * }*
>
>
> In this way, we should not miss release or retain every time we use
> ReferenceCount
>

Reply via email to