summaryrefslogtreecommitdiffstats
path: root/src/matcher.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-02-18 00:51:44 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-02-18 00:51:44 +0900
commitf5b034095a74ae88410bf3383c39b1e99c0f36a0 (patch)
tree02bfe6a401a0350b2c7c8fb71dffa40974177303 /src/matcher.go
parent95e5beb34e8baa324a3bee59e2705c3c942b5427 (diff)
Fix race condition in asynchronous -1 and -0
Diffstat (limited to 'src/matcher.go')
-rw-r--r--src/matcher.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/matcher.go b/src/matcher.go
index 84130b23..bfe9d287 100644
--- a/src/matcher.go
+++ b/src/matcher.go
@@ -14,6 +14,7 @@ import (
type MatchRequest struct {
chunks []*Chunk
pattern *Pattern
+ final bool
}
// Matcher is responsible for performing search
@@ -91,6 +92,7 @@ func (m *Matcher) Loop() {
if !cancelled {
m.mergerCache[patternString] = merger
+ merger.final = request.final
m.eventBox.Set(EvtSearchFin, merger)
}
}
@@ -197,7 +199,7 @@ func (m *Matcher) scan(request MatchRequest) (*Merger, bool) {
}
// Reset is called to interrupt/signal the ongoing search
-func (m *Matcher) Reset(chunks []*Chunk, patternRunes []rune, cancel bool) {
+func (m *Matcher) Reset(chunks []*Chunk, patternRunes []rune, cancel bool, final bool) {
pattern := m.patternBuilder(patternRunes)
var event util.EventType
@@ -206,5 +208,5 @@ func (m *Matcher) Reset(chunks []*Chunk, patternRunes []rune, cancel bool) {
} else {
event = reqRetry
}
- m.reqBox.Set(event, MatchRequest{chunks, pattern})
+ m.reqBox.Set(event, MatchRequest{chunks, pattern, final})
}