Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix data races in stream.state #36

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aykevl
Copy link
Contributor

@aykevl aykevl commented Sep 22, 2024

PlaybackStream and RecordStream had both a 'state' variable that got read and updated from different goroutines. This is a data race, and shows up when running with the -race flag.

I've tried to make the code a bit less racy, and used an atomic value to fix the warnings about the race condition. I'm still not 100% convinced this fixes all races though.

(Draft, because it conflicts with #35. I'll rebase once that PR gets merged or closed).

Provide a way for an application to receive volume change notifications
when the volume changes (either through SetVolume or because it was
changed in the system mixer settings).
PlaybackStream and RecordStream had both a 'state' variable that got
read and updated from different goroutines. This is a data race, and
shows up when running with the -race flag.

I've tried to make the code a bit less racy, and used an atomic value to
fix the warnings about the race condition. I'm still not 100% convinced
this fixes all races though.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant