sync package - sync - Go Packages
Package sync provides basic synchronization primitives such as mutual exclusion locks. Other than the Once and WaitGroup types, most are intended for use by low-level library routines. Higher-level synchronization is better done via channels and communication. Values containing the types defined in this package should not be copied. This section is empty. This section is empty. OnceFunc returns a function that invokes f only once. The returned function may be called concurrently. If f panics, the returned function will panic with the same value on every call. OnceValue returns a function that invokes f only once and returns the value returned by f. The returned function may be called concurrently. If f panics, the returned function will panic with the same value on every call. OnceValues returns a function that invokes f only once and returns the values returned by f. The returned function may be called concurrently. If f panics, the returned function will panic with the same value on
Documentation ¶ Overview ¶ Package sync provides basic synchronization primitives such as mutual exclusion locks. Other than the Once and WaitGroup types, most are intended for use by low-level library routines. Higher-level synchronization is better done via channels and communication. Values containing the types defined in this package should not be copied. Index ¶ func OnceFunc(f func()) func() func OnceValue[T any](f func() T) func() T func OnceValues[T1, T2 any](f func() (T1, T2)) func() (T1, T2) type Cond func NewCond(l Locker) *Cond func (c *Cond) Broadcast() func (c *Cond) Signal() fun
saved by
related reading
- Demystifying Function Parameters in Go- Alex Edwardsalexedwards.net
- golang mutex, go mutex, mutex lock golang, golang mutex example, sync.RWMutexgolinuxcloud.com
- Go Slices: usage and internals - The Go Programming Languagego.dev
- The Go Memory Model - The Go Programming Languagego.dev
- Frequently Asked Questions (FAQ) - The Go Programming Languagego.dev
- Go go-to guide · YourBasicyourbasic.org
- Notes on structured concurrency, or: Go statement considered harmful - njs blogvorpus.org
- LittleBookOfSemaphores.pdfgreenteapress.com
- Data Race Detector - The Go Programming Languagego.dev
- Mutex in std::sync - Rustdoc.rust-lang.org
- Unreliable Guide To Locking — The Linux Kernel documentationdocs.kernel.org
- Reading 16: Mutual Exclusionweb.mit.edu