Skip to content

Commit 94f344b

Browse files
committed
Fix deadlock when using 'vision' time acquisition mode
1 parent 91fcbfa commit 94f344b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

internal/app/vision/visionReceiver.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ func (v *Receiver) Stop() {
3939
}
4040

4141
func (v *Receiver) consumeData(data []byte) {
42-
v.mutex.Lock()
43-
defer v.mutex.Unlock()
44-
4542
wrapper := SSL_WrapperPacket{}
4643
if err := proto.Unmarshal(data, &wrapper); err != nil {
4744
log.Println("Could not unmarshal vision wrapper packet", err)
@@ -52,7 +49,9 @@ func (v *Receiver) consumeData(data []byte) {
5249
v.GeometryCallback(wrapper.Geometry)
5350
}
5451
if wrapper.Detection != nil {
52+
v.mutex.Lock()
5553
v.latestTimestamp = timer.TimestampToTime(*wrapper.Detection.TCapture)
54+
v.mutex.Unlock()
5655
v.DetectionCallback(wrapper.Detection)
5756
}
5857
}

0 commit comments

Comments
 (0)