sync

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RWMutexMap

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

RWMutexMap is a concurrency-safe map, using a sync.RWMutex to lock a backing map when accessing values.

func (*RWMutexMap[T]) Del

func (m *RWMutexMap[T]) Del(k string)

Del sets a read-write lock on the map and deletes the value for k from it.

func (*RWMutexMap[T]) Get

func (m *RWMutexMap[T]) Get(k string) (T, bool)

Get sets a read lock on the map, retrieving the value for k. A second return value indicates whether the key was present in the map.

func (*RWMutexMap[T]) Set

func (m *RWMutexMap[T]) Set(k string, t T)

Set locks the map, setting the key k to the value t.

func (*RWMutexMap[T]) Visit

func (m *RWMutexMap[T]) Visit(f func(k string, v T))

Visit read-locks the map and calls the function f for each member.

Jump to

Keyboard shortcuts

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