Ignore EvtReadNew if EvtReadFin is already set
This commit is contained in:
parent
941b0a0ff7
commit
55ee4186aa
@ -188,7 +188,6 @@ func Run(opts *Options, revision string) {
|
||||
if opts.Sync {
|
||||
eventBox.Unwatch(EvtReadNew)
|
||||
eventBox.WaitFor(EvtReadFin)
|
||||
eventBox.Unset(EvtReadNew)
|
||||
}
|
||||
|
||||
// Go interactive
|
||||
@ -210,6 +209,9 @@ func Run(opts *Options, revision string) {
|
||||
delay := true
|
||||
ticks++
|
||||
eventBox.Wait(func(events *util.Events) {
|
||||
if _, fin := (*events)[EvtReadFin]; fin {
|
||||
delete(*events, EvtReadNew)
|
||||
}
|
||||
for evt, value := range *events {
|
||||
switch evt {
|
||||
|
||||
|
@ -45,13 +45,6 @@ func (b *EventBox) Set(event EventType, value interface{}) {
|
||||
b.cond.L.Unlock()
|
||||
}
|
||||
|
||||
// Unset turns off the event type on the box
|
||||
func (b *EventBox) Unset(event EventType) {
|
||||
b.cond.L.Lock()
|
||||
delete(b.events, event)
|
||||
b.cond.L.Unlock()
|
||||
}
|
||||
|
||||
// Clear clears the events
|
||||
// Unsynchronized; should be called within Wait routine
|
||||
func (events *Events) Clear() {
|
||||
|
Loading…
Reference in New Issue
Block a user