[Spice-devel] source code question: how hold_rcc works?

Frediano Ziglio freddy77 at gmail.com
Fri May 27 08:28:21 UTC 2022


Il giorno ven 27 mag 2022 alle ore 09:23 Walter Mitty <
waltermitty121906 at gmail.com> ha scritto:

> Hi guys,
> I've been learning spice server source code for a few days. And there is a
> function named *hold_rcc *that makes me confused. I can't find its
> definition. I guess it is not a regular declaration. It may be generated
> from a template. I wanna figure out how it is declared and what it does?
> Could anyone give me some advice? Thanks in advance.
>
> Best wishes,
> Walter.
>

Hi,
   there are multiple definitions of that variable, all

red::shared_ptr<RedChannelClient> hold_rcc(rcc);

that's just a construction of a shared pointer "holding" rcc. It makes sure
the object is not released till the scope of hold_rcc.
In some cases it's possible that there are no strong pointers to these
objects so we make sure to have one.

Frediano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20220527/2e91bee5/attachment.htm>


More information about the Spice-devel mailing list