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

Codechange: move curl into a thread so simplify code #10480

Merged
merged 1 commit into from Feb 15, 2023

Conversation

TrueBrain
Copy link
Member

Motivation / Problem

The async variant of curl gave too much trouble / noise. Switching to a threaded/sync solution brings it on-par with WinHttp, and makes the code a lot easier.

Description

With a thread, we can just run curl_easy_perform() and let CURL and threads handle the blocking part.

With async solution there are too many things to keep track of, and it makes "when to update the GUI" tricky. By using a thread that all gets a lot simpler, as the game-thread and download-thread run side-by-side.

This is similar to how the WinHttp backend already works.

Limitations

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR touches english.txt or translations? Check the guidelines
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

frosch123
frosch123 previously approved these changes Feb 14, 2023
With a thread, we can just run curl_easy_perform() and let CURL
and threads handle the blocking part.

With async solution there are too many things to keep track of,
and it makes "when to update the GUI" tricky. By using a thread
that all gets a lot simpler, as the game-thread and download-thread
run side-by-side.

This is similar to how the WinHttp backend already works.
@TrueBrain TrueBrain merged commit ea90fa2 into OpenTTD:master Feb 15, 2023
@TrueBrain TrueBrain deleted the curl-in-thread branch February 15, 2023 20:56
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.

None yet

4 participants