From 8d573788b1b53cb2ff6714698a9ca421bf96d377 Mon Sep 17 00:00:00 2001 From: Christopher Young Date: Sun, 20 Dec 2015 23:38:42 -0500 Subject: [PATCH] Wait for UAT read goroutine to quit before calling .Close() on device. --- main/sdr.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/sdr.go b/main/sdr.go index 3ac71e9c..d0e7097b 100644 --- a/main/sdr.go +++ b/main/sdr.go @@ -256,11 +256,11 @@ func (e *ES) writeID() error { func (u *UAT) shutdown() { log.Println("Entered UAT shutdown() ...") close(uat_shutdown) // signal to shutdown - log.Println("UAT shutdown(): closing device ...") - u.dev.Close() // preempt the blocking ReadSync call log.Println("UAT shutdown(): calling uat_wg.Wait() ...") uat_wg.Wait() // Wait for the goroutine to shutdown log.Println("UAT shutdown(): uat_wg.Wait() returned...") + log.Println("UAT shutdown(): closing device ...") + u.dev.Close() // preempt the blocking ReadSync call } func (e *ES) shutdown() {