YTSFlix_Go/vendor/github.com/anacrolix/missinggo/event_synchronized.go
2018-11-04 15:58:15 +01:00

27 lines
368 B
Go

package missinggo
import "sync"
type SynchronizedEvent struct {
mu sync.Mutex
e Event
}
func (me *SynchronizedEvent) Set() {
me.mu.Lock()
me.e.Set()
me.mu.Unlock()
}
func (me *SynchronizedEvent) Clear() {
me.mu.Lock()
me.e.Clear()
me.mu.Unlock()
}
func (me *SynchronizedEvent) C() <-chan struct{} {
me.mu.Lock()
defer me.mu.Unlock()
return me.e.C()
}