#Cond

1 articles

Getting to Know Sync Cond on Golang

Getting to Know Sync Cond on Golang

Introduction of sync.Cond

sync.Cond is a locking process that is used with certain conditions. sync.Cond in the Golang synchronization package implements conditional variables that can be used in scenarios where multiple readers are waiting for concurrent resources. Cond pooling point: multiple goroutines waiting, 1 goroutine notification event occurs. Each Cond is associated with a Lock **(sync.Mutex or sync.RWMutex) that should be added when modifying the condition or calling the wait() method, to protect the condition.