Files
deep_go/lessons/sync_primitives/defer_with_mutex/main.go

22 lines
233 B
Go

package main
import "sync"
// Need to show solution
var mutex sync.Mutex
func operation() {}
func doSomething() {
mutex.Lock()
operation()
mutex.Unlock()
// some long operation
mutex.Lock()
operation()
mutex.Unlock()
}