exsync

package
v0.4.43 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Value

type Value[T any] struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*Value[T]) Get

func (v *Value[T]) Get() T

Get value and acquire lock You must manually call Unlock() after using the value

func (*Value[T]) Set

func (v *Value[T]) Set(newValue T)

Set value (will acquire lock before set and unlock after set)

func (*Value[T]) With

func (v *Value[T]) With(f func(v T))

With will call f with the value and unlock it after f returns

func (*Value[T]) WithE

func (v *Value[T]) WithE(f func(v T) error) error

WithE equals With, but f can return an error

Jump to

Keyboard shortcuts

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