INNER CODE UNIT · Go
NewSyncableConfig
NVIDIA/k8s-device-plugin · cmd/config-manager/main.go:90
func NewSyncableConfig(f *Flags) *SyncableConfig {
var m SyncableConfig
m.cond = sync.NewCond(&m.mutex)
return &m
}
// Set sets the value of the config.
// All callers of Get() before the Set() will be unblocked.
func (m *SyncableConfig) Set(value string) {
m.mutex.Lock()
defer m.mutex.Unlock()
m.current = value
m.cond.Broadcast()
}
// Get gets the value of the config.
// A call to Get() will block until a subsequent Set() call is made.
func (m *SyncableConfig) Get() string {