syncutil

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SyncedQ

type SyncedQ struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewSyncedQ

func NewSyncedQ() *SyncedQ

func (*SyncedQ) PeekFront

func (sq *SyncedQ) PeekFront() (any, bool)

func (*SyncedQ) PopFront

func (sq *SyncedQ) PopFront() any

Waits until a value is available

func (*SyncedQ) PushBack

func (sq *SyncedQ) PushBack(v any)

type WaitForSet

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

Continously usable, instantiated once for many wait()/set() calls. Fails if wait() is not ready when set() is called. Usage:

w:=NewWaitForSet()
w.Start(5*time.Second)
...
// sync/async call to w.Set()
...
v,err := w.WaitForSet()
if err!=nil {
}

func NewWaitForSet

func NewWaitForSet() *WaitForSet

func (*WaitForSet) Cancel

func (w *WaitForSet) Cancel()

In case waitforset() is not going to be called.

func (*WaitForSet) Set

func (w *WaitForSet) Set(v any) error

Fails if not able to set while get() is ready.

func (*WaitForSet) Start

func (w *WaitForSet) Start(timeout time.Duration)

func (*WaitForSet) WaitForSet

func (w *WaitForSet) WaitForSet() (any, error)

Jump to

Keyboard shortcuts

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