func (w *KeyedValue) WaitForChange(k string) interface{} {
	w.lock.Lock()
	w.once.Do(w.init)
	if w.closed {
		w.lock.Unlock()
		return ErrClosed
	}
	val := w.waiters[k]
	if val == nil {
		val = new(Value)
		w.waiters[k] = val
	}
	w.lock.Unlock()
	return val.Value()
}
WaitForChange waits for the value with the given key to be set again.
If the key isn't set, it'll wait for an initial value. Note that while
it is called "WaitForChange", the value isn't guaranteed to _change_;
this will return when a SetValue is called for the given k.
package shadow
import (
	"sync"
)
type KeyedValue struct {
	lock    sync.Mutex
	once    sync.Once
	values  map[string]interface{}
	waiters map[string]*Value
	closed  bool
}
func (w *KeyedValue) Close() error {
	w.lock.Lock()
	defer w.lock.Unlock()
	w.closed = true
	for k, val := range w.waiters {
		val.SetValue(ErrClosed)
		delete(w.waiters, k)
	}
	return nil
}
func (w *KeyedValue) Value(k string) interface{} {
	w.lock.Lock()
	v, val := w.valueWaiter(k)
	w.lock.Unlock()
	if val == nil {
		return v
	}
	return val.Value()
}