diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2017-08-20 14:29:50 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2017-08-20 14:30:17 +0900 |
commit | 55ee4186aa688e524e041971d588a6f002486deb (patch) | |
tree | ea7134fc3d228e0a2cdf8fd2f80f76cf8dc01a03 /src | |
parent | 941b0a0ff7c15f7cd51f8f6b4e9a64fd48902ef5 (diff) |
Ignore EvtReadNew if EvtReadFin is already set
Diffstat (limited to 'src')
-rw-r--r-- | src/core.go | 4 | ||||
-rw-r--r-- | src/util/eventbox.go | 7 |
2 files changed, 3 insertions, 8 deletions
diff --git a/src/core.go b/src/core.go index 1c8182ea..023f7be7 100644 --- a/src/core.go +++ b/src/core.go @@ -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 { diff --git a/src/util/eventbox.go b/src/util/eventbox.go index acd95616..b710cf1e 100644 --- a/src/util/eventbox.go +++ b/src/util/eventbox.go @@ -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() { |