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

WaveRecorder: fix hang in StreamingThread #106

Merged
merged 2 commits into from
Jan 30, 2022
Merged

WaveRecorder: fix hang in StreamingThread #106

merged 2 commits into from
Jan 30, 2022

Conversation

philburk
Copy link
Owner

The read() could hang forever waiting for data when the
WaveRecorder was stopped.
Now it terminates the thread.

Fixes #105

The read() could hang forever waiting for data when the
WaveRecorder was stopped.
Now it terminates the thread.

Fixes #105
buffer[i + start] = read();
numRead++;
}
} else {
if (available() < count) {
count = available();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you didn't ask for a PR review, but count is set here and never read.

Maybe this should be:

numRead = available();

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I'm looking at this code and see another bug when (available() < count). It does not read any data.
I added a test for that.

@philburk philburk merged commit e792b44 into master Jan 30, 2022
@philburk philburk deleted the fix_thread_105 branch January 30, 2022 19:14
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.

Sometimes WaveRecorder doesn't stop the StreamingThread when used with realTime = false
2 participants