concurrent

package module
v0.0.0-...-ffc6068 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunPeriodically

func RunPeriodically(f func(), stop chan bool, interval time.Duration)

RunPeriodically invokes function "f" every "interval" until something is sent to the "stop" channel. If the "stop" channel is null, then the invocation never stops.

func WaitForSomething

func WaitForSomething[T any](src ValueProvider[T]) optional.Optional[T]

WaitForSomething blocks until src returns optional with value or with error. By default, it tries 30 times with 1 second interval between retries

func WaitForValue

func WaitForValue[T comparable](value T, src ValueProvider[T])

WaitForValue blocks until src returns optional with given value or with error. By default, it tries 30 times with 1 second interval between retries

func WaitForValueRetries

func WaitForValueRetries[T comparable](value T, src ValueProvider[T], retryCount int)

Types

type Condition

type Condition[T any] func(optional.Optional[T]) bool

func NewEquals

func NewEquals[T comparable](value T) Condition[T]

func NewIsPresent

func NewIsPresent[T any]() Condition[T]

type Executor

type Executor interface {
	Execute(task func())
	Shutdown()
}

func NewPoolExecutor

func NewPoolExecutor(workerCount int) (Executor, error)

type ValueProvider

type ValueProvider[T any] func() optional.Optional[T]

type Waiter

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

func (*Waiter[T]) Wait

func (w *Waiter[T]) Wait() optional.Optional[T]

Jump to

Keyboard shortcuts

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