Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
bastimeyer merged 1 commit into
streamlink:masterfrom
bastimeyer:stream/segmented/properly-fix-wait-in-writer-thread-tool
Mar 11, 2023
Merged

stream.segmented: properly fix wait() in writer#5237
bastimeyer merged 1 commit into
streamlink:masterfrom
bastimeyer:stream/segmented/properly-fix-wait-in-writer-thread-tool

Conversation

@bastimeyer

Copy link
Copy Markdown
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