Source File
reset_ready.go
Belonging Package
github.com/gotd/td/internal/tdsync
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()
}
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |