Skip to content

stream.segmented: properly fix wait() in writer #5237

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

Conversation

bastimeyer
Copy link
Member

Follow-up of f234c69

Properly fix the SegmentedStreamWriter's _wait Event when closing the thread.

Depending on which thread attempted to close the writer thread, the close() method's self.reader.close() call can block, leading to the _wait event to not get set until all threads have terminated and joined. So make sure to set the event first, so that all threads of the writer's thread-pool executor can be stopped first, for example segment downloads waiting for the segment's availability.


Follow-up of #5236

Follow-up of f234c69

Properly fix the `SegmentedStreamWriter`'s `_wait` Event when closing
the thread.

Depending on which thread attempted to close the writer thread,
the `close()` method's `self.reader.close()` call can block, leading
to the `_wait` event to not get set until all threads have terminated
and joined. So make sure to set the event first, so that all threads
of the writer's thread-pool executor can be stopped first,
for example segment downloads waiting for the segment's availability.
@bastimeyer bastimeyer merged commit 142d17f into streamlink:master Mar 11, 2023
@bastimeyer bastimeyer deleted the stream/segmented/properly-fix-wait-in-writer-thread-tool branch March 11, 2023 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant