amazing GO detection on needing a mutex. Very impressive!
This commit is contained in:
parent
aea63ab19c
commit
1dfac22abc
|
@ -1,10 +1,13 @@
|
|||
package config
|
||||
|
||||
import "sync"
|
||||
|
||||
// this package can provide a trivial way to track which
|
||||
// protobufs have been modified and need to be written to disk
|
||||
// todo: autogenpb could generate code to work with this
|
||||
|
||||
var saveMap map[string]bool
|
||||
var saveLock sync.Mutex
|
||||
|
||||
func init() {
|
||||
// init() should be avoided, but this package and for making
|
||||
|
@ -13,6 +16,8 @@ func init() {
|
|||
}
|
||||
|
||||
func SetChanged(name string, b bool) {
|
||||
saveLock.Lock()
|
||||
defer saveLock.Unlock()
|
||||
saveMap[name] = b
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue