refcount

package
v2.18.2+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package refcount implements a reference-counting client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ref

type Ref struct {
	// contains filtered or unexported fields
}

A Ref is a single reference to a client wrapped by RefCount.

func (*Ref) Call

func (r *Ref) Call(cl *capnp.Call) capnp.Answer

Call makes a call on the underlying client.

func (*Ref) Client

func (r *Ref) Client() capnp.Client

Client returns the underlying client.

func (*Ref) Close

func (r *Ref) Close() error

Close decrements the reference count. Close will be called on finalization (i.e. garbage collection).

type RefCount

type RefCount struct {
	Client capnp.Client
	// contains filtered or unexported fields
}

A RefCount will close its underlying client once all its references are closed.

func New

func New(c capnp.Client) (rc *RefCount, ref1 capnp.Client)

New creates a reference counter and the first client reference.

func (*RefCount) Ref

func (rc *RefCount) Ref() capnp.Client

Ref makes a new client reference.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL