utils

package
v0.0.0-...-d28accb Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JoinErrors

func JoinErrors(errors []error, sep string) string

JoinErrors объединяет ошибки из массива в строку с разделителем sep

Types

type Cond

type Cond struct {
	L sync.Locker
	// contains filtered or unexported fields
}

Cond is a conditional variable implementation that uses channels for notifications. Only supports .Broadcast() method, however supports timeout based Wait() calls unlike regular sync.Cond.

func NewCond

func NewCond(l sync.Locker) *Cond

NewCond creates a new condition lock object

func (*Cond) Broadcast

func (c *Cond) Broadcast()

Broadcast call notifies everyone that something has changed.

func (*Cond) NotifyChan

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

NotifyChan returns a channel that can be used to wait for next Broadcast() call.

func (*Cond) Wait

func (c *Cond) Wait()

Wait is waits for Broadcast calls. Similar to regular sync.Cond, this unlocks the underlying locker first, waits on changes and re-locks it before returning.

func (*Cond) WaitWithTimeout

func (c *Cond) WaitWithTimeout(t time.Duration)

WaitWithTimeout is same as Wait() call, but will only wait up to a given timeout.

Jump to

Keyboard shortcuts

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