Wait for UAT read goroutine to quit before calling .Close() on device.

pull/156/head
Christopher Young 2015-12-20 23:38:42 -05:00
rodzic 71b4f3c2c0
commit 8d573788b1
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -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() {