Skip to content

Commit b2e2cd5

Browse files
committed
darwin: bug fix: race at a channel
Closes #252
1 parent 95db1d7 commit b2e2cd5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

driver_darwin.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,9 @@ func newContext(sampleRate int, channelCount int, format mux.Format, bufferSizeI
125125
runtime.LockOSThread()
126126
defer runtime.UnlockOSThread()
127127

128+
var readyClosed bool
128129
defer func() {
129-
if ready != nil {
130+
if !readyClosed {
130131
close(ready)
131132
}
132133
}()
@@ -158,7 +159,7 @@ func newContext(sampleRate int, channelCount int, format mux.Format, bufferSizeI
158159
}
159160

160161
close(ready)
161-
ready = nil
162+
readyClosed = true
162163

163164
c.loop()
164165
}()

0 commit comments

Comments
 (0)