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

Toggle or stop download thread-safely #132

Merged
merged 1 commit into from
Jul 22, 2024

Conversation

slipher
Copy link
Contributor

@slipher slipher commented Jul 21, 2024

The download loop which downloads using libaria2 runs in a secondary thread. The downloader's toggle and stop functions were called from the main thread. The 'stop' case was probably harmless in practice, but the toggle case manipulates the aria objects which are concurrently used by the download thread in a dangerous way.

Fix this by defining toggle and stop as signals which are sent to the downloader thread, and have the download loop manually check the thread's event queue.

The download loop which downloads using libaria2 runs in a secondary
thread. The downloader's toggle and stop functions were called from the
main thread. The 'stop' case was probably harmless in practice, but the
toggle case manipulates the aria objects which are concurrently used by
the download thread in a dangerous way.

Fix this by defining toggle and stop as signals which are sent to the
downloader thread, and have the download loop manually check the
thread's event queue.
@slipher slipher merged commit 74a3db2 into Unvanquished:master Jul 22, 2024
3 checks passed
@slipher slipher deleted the threadsafe branch July 22, 2024 20:32
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.

2 participants