msync

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2022 License: BSD-3-Clause Imports: 1 Imported by: 0 modules, 1 package

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.

README

msync

GoDoc

This repository defines a library of Go types to help in the management of concurrency.

Documentation

Overview

Package msync defines some helpful types for managing concurrency.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handoff

type Handoff[T any] struct {
	// contains filtered or unexported fields
}

Handoff is a singly-buffered level-triggered rendezvous channel. A waiter blocks on the Ready channel until a value is provided by Send. A value handed off persists until consumed.

func NewHandoff

func NewHandoff[T any]() *Handoff[T]

NewHandoff constructs a new empty handoff.

func (*Handoff[T]) Ready

func (h *Handoff[T]) Ready() <-chan T

Ready returns a channel that delivers a value when a handoff is available.

func (*Handoff[T]) Send

func (h *Handoff[T]) Send(v T)

Send provides a value to handoff. Send does not block. Once v is sent to h, subsequent calls to Send will be discarded until a receiver accepts the handoff of v.

type Trigger

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

Trigger is an edge-triggered condition. It is analogous in effect to the standard sync.Cond type, but uses a channel for signaling so that the waiters can select on its completion.

A zero value is ready for use but must not be copied after first use.

func NewTrigger

func NewTrigger() *Trigger

NewTrigger constructs a new unready Trigger.

func (*Trigger) Ready

func (t *Trigger) Ready() <-chan struct{}

Ready returns a channel that is closed when t is signaled.

func (*Trigger) Signal

func (t *Trigger) Signal()

Signal wakes all pending waiters and resets the trigger.

Jump to

Keyboard shortcuts

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