Skip to content

Commit 8144cbd

Browse files
committed
Remove go routine from listen it should be up to the implementer
1 parent 97172c8 commit 8144cbd

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

dualshock.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,14 @@ func (c *Controller) read() {
163163

164164
// Listen for controller state changes
165165
func (c *Controller) Listen(handle func(State)) {
166-
go func() {
167-
for {
168-
select {
169-
case <-c.interrupt:
170-
return
171-
default:
172-
handle(transform(<-c.queue))
173-
}
166+
for {
167+
select {
168+
case <-c.interrupt:
169+
return
170+
default:
171+
handle(transform(<-c.queue))
174172
}
175-
}()
173+
}
176174
}
177175

178176
// Errors returns a channel of reader errors

0 commit comments

Comments
 (0)