synctest

package standard library
go1.26.10 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: BSD-3-Clause Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package synctest provides support for testing concurrent code.

See the testing/synctest package for function documentation.

Index

Constants

View Source
const (
	Unbubbled     = Association(iota) // not associated with any bubble
	CurrentBubble                     // associated with the current bubble
	OtherBubble                       // associated with a different bubble
)

Variables

This section is empty.

Functions

func Disassociate added in go1.25.0

func Disassociate[T any](p *T)

Disassociate disassociates p from any bubble.

func IsAssociated added in go1.25.0

func IsAssociated[T any](p *T) bool

IsAssociated reports whether p is associated with the current bubble.

func IsInBubble added in go1.25.0

func IsInBubble() bool

IsInBubble reports whether the current goroutine is in a bubble.

func Run

func Run(f func())

func Wait

func Wait()

Types

type Association added in go1.25.0

type Association int

Association is the state of a pointer's bubble association.

func Associate added in go1.25.0

func Associate[T any](p *T) Association

Associate attempts to associate p with the current bubble. It returns the new association status of p.

type Bubble

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

A Bubble is a synctest bubble.

Not a public API. Used by syscall/js to propagate bubble membership through syscalls.

func Acquire

func Acquire() *Bubble

Acquire returns a reference to the current goroutine's bubble. The bubble will not become idle until Release is called.

func (*Bubble) Release

func (b *Bubble) Release()

Release releases the reference to the bubble, allowing it to become idle again.

func (*Bubble) Run

func (b *Bubble) Run(f func())

Run executes f in the bubble. The current goroutine must not be part of a bubble.

Jump to

Keyboard shortcuts

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