sync

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BufferedChannel

func BufferedChannel[T any](n int) (sender *ChannelSender[T], receiver *ChannelReceiver[T])

func UnbufferedChannel

func UnbufferedChannel[T any]() (sender *ChannelSender[T], receiver *ChannelReceiver[T])

Types

type ChannelReceiver

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

func (*ChannelReceiver[T]) Range

func (r *ChannelReceiver[T]) Range(f func(T))

func (*ChannelReceiver[T]) Receive

func (r *ChannelReceiver[T]) Receive() (v T, ok bool)

func (*ChannelReceiver[T]) ReceiveTimeout

func (r *ChannelReceiver[T]) ReceiveTimeout(duration time.Duration) (v T, ok bool)

type ChannelSender

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

func (*ChannelSender[T]) Close

func (cs *ChannelSender[T]) Close()

func (*ChannelSender[T]) Send

func (cs *ChannelSender[T]) Send(v T) bool

func (*ChannelSender[T]) SendTimeout

func (cs *ChannelSender[T]) SendTimeout(v T, duration time.Duration) bool

type Map

type Map[K any, V any] struct {
	// contains filtered or unexported fields
}

Map is generic version of sync.Map.

func (*Map[K, V]) Delete

func (self *Map[K, V]) Delete(key K)

func (*Map[K, V]) Get

func (self *Map[K, V]) Get(key K) (V, bool)

func (*Map[K, V]) GetOptional

func (self *Map[K, V]) GetOptional(key K) optional.Optional[V]

func (*Map[K, V]) GetOrPut

func (self *Map[K, V]) GetOrPut(key K, val V) (V, bool)

func (*Map[K, V]) Insert

func (self *Map[K, V]) Insert(key K, v V)

func (*Map[K, V]) Range

func (self *Map[K, V]) Range(fn func(K, V) bool)

type Pool

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

Pool is generic version of sync.Pool

func NewPool

func NewPool[T any](fn func() *T) *Pool[T]

func (*Pool[T]) Get

func (self *Pool[T]) Get() *T

func (*Pool[T]) Put

func (self *Pool[T]) Put(val *T)

Jump to

Keyboard shortcuts

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