ctxsync

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2019 License: Apache-2.0 Imports: 2 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cond

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

A Cond is a condition variable that implements a context-aware Wait.

func NewCond

func NewCond(l sync.Locker) *Cond

NewCond returns a new ContextCond based on Locker l.

func (*Cond) Broadcast

func (c *Cond) Broadcast()

Broadcast notifies waiters of a state change. Broadcast must only be called while the cond's lock is held.

func (*Cond) Done

func (c *Cond) Done() <-chan struct{}

Done returns a channel that is closed after the next broadcast of this Cond. Done mus tbe called with the Cond's lock held; the lock is released before Done returns.

func (*Cond) Wait

func (c *Cond) Wait(ctx context.Context) error

Wait returns after the next call to Broadcast, or if the context is complete. The context's lock must be held when calling Wait. An error returns with the context's error if the context completes while waiting.

Jump to

Keyboard shortcuts

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