Skip to content

Commit

Permalink
Wait for UAT read goroutine to quit before calling .Close() on device.
Browse files Browse the repository at this point in the history
  • Loading branch information
cyoung committed Dec 21, 2015
1 parent 71b4f3c commit 8d57378
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main/sdr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 8d57378

Please sign in to comment.