package grpcsync

import "google.golang.org/grpc/internal/grpcsync"

Package grpcsync implements additional synchronization primitives built upon the sync package.

Index

Functions

func OnceFunc

func OnceFunc(f func()) func()

OnceFunc returns a function wrapping f which ensures f is only executed once even if the returned function is executed multiple times.

Types

type Event

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

Event represents a one-time event that may occur in the future.

func NewEvent

func NewEvent() *Event

NewEvent returns a new, ready-to-use Event.

func (*Event) Done

func (e *Event) Done() <-chan struct{}

Done returns a channel that will be closed when Fire is called.

func (*Event) Fire

func (e *Event) Fire() bool

Fire causes e to complete. It is safe to call multiple times, and concurrently. It returns true iff this call to Fire caused the signaling channel returned by Done to close.

func (*Event) HasFired

func (e *Event) HasFired() bool

HasFired returns true if Fire has been called.

Source Files

event.go oncefunc.go

Version
v1.55.0-dev
Published
Mar 17, 2023
Platform
linux/amd64
Imports
2 packages
Last checked
6 hours ago

Tools for package owners.