syncutils

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 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 ReadVarFunc

type ReadVarFunc[T any] func(v T)

ReadVarFunc 回调变量用来读的函数

type SyncVar

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

SyncVar 线程安全的变量封装

func NewSyncVar

func NewSyncVar[T any](v T, isRWMutex bool) *SyncVar[T]

NewSyncVar 创建线程安全的变量

func (*SyncVar[T]) ForRead

func (syncVar *SyncVar[T]) ForRead(readVarFunc ReadVarFunc[T])

ForRead 为写而获取变量

func (*SyncVar[T]) ForWrite

func (syncVar *SyncVar[T]) ForWrite(writeVarFunc WriteVarFunc[T])

ForWrite 为写而获取变量

type WriteVarFunc

type WriteVarFunc[T any] func(v T) T

WriteVarFunc 回调变量用来写的函数

Jump to

Keyboard shortcuts

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