-
-
Notifications
You must be signed in to change notification settings - Fork 112
Ref Counting
Louis Thibault edited this page Jan 28, 2022
·
8 revisions
- By default, the caller is responsible for calling
Release()
on a capability when finished. - Calling
foo.Bar(baz)
wherefoo
andbaz
are capabilities transfers ownership offoo
tobaz
. Thefoo
instance will callbar.Release()
when finished. - Capabilities received as arguments to an RPC handler are borrowed and will be released when the RPC handler returns. You may call
AddRef()
to persist a capability beyond the scope of the RPC handler, at which point Rule 1 applies.
- [ BUG ] Passing a capability to itself causes a deadlock.