backgroundcontext

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 4 Imported by: 6

Documentation

Overview

Package backgroundcontext manages the singleton v23 context. This package is not for general use. It it only for packages that (1) need to access a background context, and (2) are used both as a binary and as a shared library (e.g., in R).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get() context.Context

Get returns a background context: if a v23 context has been set, it is returned; otherwise the standard Go background context is returned.

func Set

func Set(ctx *v23context.T)

Set sets the singleton global context. It should be called at most once, usually immediately after a process starts. Calling Set() multiple times will cause a panic. Thread safe.

func T

func T() *v23context.T

T returns the background context set by Set. It panics if Set has not been called yet. Thread safe.

func Wrap

func Wrap(ctx context.Context) context.Context

Wrap wraps the provided context, composing it with the defined background context, if any. This allows contexts to be wrapped so that v23 stubs can get the background context's RPC client.

Cancelations are not forwarded: it is assumed that the set background context is never canceled.

BUG: this is very complicated; but it seems required to make vanadium play nicely with contexts defined outside of its universe.

Types

This section is empty.

Jump to

Keyboard shortcuts

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