Merge branch 'master' into jgrpp

# Conflicts:
#	src/company_cmd.cpp
#	src/company_func.h
#	src/core/overflowsafe_type.hpp
#	src/engine.cpp
#	src/music/midifile.cpp
#	src/network/network_command.cpp
#	src/newgrf_debug_gui.cpp
#	src/newgrf_roadstop.h
#	src/newgrf_spritegroup.cpp
#	src/os/macosx/crashlog_osx.cpp
#	src/os/unix/crashlog_unix.cpp
#	src/pathfinder/yapf/yapf_common.hpp
#	src/road_gui.cpp
#	src/saveload/engine_sl.cpp
#	src/script/api/script_depotlist.cpp
#	src/script/api/script_roadtypelist.cpp
#	src/settings_gui.cpp
#	src/settings_type.h
#	src/strings.cpp
#	src/table/settings/game_settings.ini
This commit is contained in:
Jonathan G Rennison
2024-01-05 13:37:52 +00:00
136 changed files with 1198 additions and 1032 deletions

View File

@@ -233,8 +233,10 @@ void HttpThread()
request->callback.OnFailure();
}
/* Wait till the callback tells us all data is dequeued. */
request->callback.WaitTillEmpty();
/* Wait till the callback tells us all data is dequeued, or _http_thread_exit has been set. */
request->callback.WaitTillEmptyOrCondition([]() -> bool {
return _http_thread_exit;
});
}
curl_easy_cleanup(curl);
@@ -277,10 +279,13 @@ void NetworkHTTPInitialize()
void NetworkHTTPUninitialize()
{
curl_global_cleanup();
_http_thread_exit = true;
/* Queues must be cleared (and the queue CV signalled) after _http_thread_exit is set to ensure that the HTTP thread can exit */
for (auto &callback : _http_callbacks) {
callback->ClearQueue();
}
{
std::lock_guard<std::mutex> lock(_http_mutex);
_http_cv.notify_one();
@@ -289,4 +294,6 @@ void NetworkHTTPUninitialize()
if (_http_thread.joinable()) {
_http_thread.join();
}
curl_global_cleanup();
}