package tdsync

import 

// ResetReady is like Ready, but can be Reset.
type ResetReady struct {
	ready Ready
	lock  sync.Mutex
}

// NewResetReady creates new ResetReady.
func () *ResetReady {
	return &ResetReady{
		ready: Ready{
			wait: make(chan struct{}),
		},
	}
}

// Reset resets underlying Ready.
func ( *ResetReady) () {
	.lock.Lock()
	.ready.Signal()
	.ready.reset()
	.lock.Unlock()
}

// Signal sends ready signal.
// Can be called multiple times.
func ( *ResetReady) () {
	.lock.Lock()
	.ready.Signal()
	.lock.Unlock()
}

// Ready returns waiting channel.
func ( *ResetReady) () <-chan struct{} {
	.lock.Lock()
	defer .lock.Unlock()
	return .ready.Ready()
}