summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2017-08-20 14:29:50 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2017-08-20 14:30:17 +0900
commit55ee4186aa688e524e041971d588a6f002486deb (patch)
treeea7134fc3d228e0a2cdf8fd2f80f76cf8dc01a03
parent941b0a0ff7c15f7cd51f8f6b4e9a64fd48902ef5 (diff)
Ignore EvtReadNew if EvtReadFin is already set
-rw-r--r--src/core.go4
-rw-r--r--src/util/eventbox.go7
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() {