Skip to content

Commit

Permalink
Dji Tello Halt does not terminate all the related goroutines and may …
Browse files Browse the repository at this point in the history
…wait forever when it is called multiple times

Fix the test for Halt method so that it waits for all the related goroutines to complete.
  • Loading branch information
st-user authored and deadprogram committed Sep 26, 2022
1 parent b07a272 commit 11259d4
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions platforms/dji/tello/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,27 +154,24 @@ func TestHaltShouldTerminateAllTheRelatedGoroutines(t *testing.T) {

d.addDoneChReaderCount(1)
go func() {
defer d.addDoneChReaderCount(-1)

<-d.doneCh
d.addDoneChReaderCount(-1)
wg.Done()
fmt.Println("Done routine 1.")
}()

d.addDoneChReaderCount(1)
go func() {
defer d.addDoneChReaderCount(-1)

<-d.doneCh
d.addDoneChReaderCount(-1)
wg.Done()
fmt.Println("Done routine 2.")
}()

d.addDoneChReaderCount(1)
go func() {
defer d.addDoneChReaderCount(-1)

<-d.doneCh
d.addDoneChReaderCount(-1)
wg.Done()
fmt.Println("Done routine 3.")
}()
Expand Down

0 comments on commit 11259d4

Please sign in to comment.