Commit a922259e authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent b2fe5727
...@@ -45,10 +45,15 @@ type SyncTracer struct { ...@@ -45,10 +45,15 @@ type SyncTracer struct {
// SyncTraceMsg represents message with 1 synchronous tracing communication. // SyncTraceMsg represents message with 1 synchronous tracing communication.
// //
// the goroutine which produced the message will wait for send on Ack before continue. // the goroutine which produced the message will wait for Ack before continue.
type SyncTraceMsg struct { type SyncTraceMsg struct {
Event interface {} Event interface {}
Ack chan<- struct{} ack chan<- struct{}
}
// Ack acknowledges the event was processed and unpauses producer goroutine.
func (m *SyncTraceMsg) Ack() {
close(m.ack)
} }
// XXX doc // XXX doc
...@@ -74,6 +79,7 @@ func (st *SyncTracer) Get1() *SyncTraceMsg { ...@@ -74,6 +79,7 @@ func (st *SyncTracer) Get1() *SyncTraceMsg {
} }
// ----------------------------------------
// XXX naming -> SyncTraceChecker // XXX naming -> SyncTraceChecker
...@@ -124,7 +130,7 @@ func (tc *TraceChecker) expect1(eventExpect interface{}) { ...@@ -124,7 +130,7 @@ func (tc *TraceChecker) expect1(eventExpect interface{}) {
pretty.Compare(reventExpect.Interface(), revent.Interface())) pretty.Compare(reventExpect.Interface(), revent.Interface()))
} }
close(msg.Ack) msg.Ack()
} }
// Expect asks checker to expect next series of events to be from eventExpectV in specified order // Expect asks checker to expect next series of events to be from eventExpectV in specified order
...@@ -152,7 +158,7 @@ loop: ...@@ -152,7 +158,7 @@ loop:
// found matching event - good // found matching event - good
eventExpectV = append(eventExpectV[:i], eventExpectV[i+1:]...) eventExpectV = append(eventExpectV[:i], eventExpectV[i+1:]...)
close(msg.Ack) // XXX -> send ack for all only when all collected? msg.Ack() // XXX -> send ack for all only when all collected?
continue loop continue loop
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment