Исходники и презентации
This commit is contained in:
20
lessons/sync_primitives/cond_operations/main.go
Normal file
20
lessons/sync_primitives/cond_operations/main.go
Normal file
@ -0,0 +1,20 @@
|
||||
package main
|
||||
|
||||
import "sync"
|
||||
|
||||
func waitWithoutLock() {
|
||||
cond := sync.NewCond(&sync.Mutex{})
|
||||
cond.Wait()
|
||||
}
|
||||
|
||||
func waitAfterSignal() {
|
||||
cond := sync.NewCond(&sync.Mutex{})
|
||||
cond.Signal()
|
||||
|
||||
cond.L.Lock()
|
||||
cond.Wait()
|
||||
cond.L.Unlock()
|
||||
}
|
||||
|
||||
func main() {
|
||||
}
|
||||
Reference in New Issue
Block a user