INNER CODE UNIT · Go

func

NVIDIA/k8s-device-plugin · cmd/config-manager/main.go:98

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 {
	m.mutex.Lock()
	defer m.mutex.Unlock()
	if m.lastRead != nil && *m.lastRead == m.current {
		m.cond.Wait()
	}
	val := m.current
	m.lastRead = &val
	return *m.lastRead

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…