Skip to content

Commit

Permalink
Remove go routine from listen it should be up to the implementer
Browse files Browse the repository at this point in the history
  • Loading branch information
quartercastle committed May 22, 2019
1 parent 97172c8 commit 8144cbd
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions dualshock.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,14 @@ func (c *Controller) read() {

// Listen for controller state changes
func (c *Controller) Listen(handle func(State)) {
go func() {
for {
select {
case <-c.interrupt:
return
default:
handle(transform(<-c.queue))
}
for {
select {
case <-c.interrupt:
return
default:
handle(transform(<-c.queue))
}
}()
}
}

// Errors returns a channel of reader errors
Expand Down

0 comments on commit 8144cbd

Please sign in to comment.