Run multiple session save requests in parallel.

This commit is contained in:
Jari Sundell
2025-12-21 22:26:35 +01:00
committed by GitHub
parent 5dbb0020dc
commit 4bdeb58eb6
21 changed files with 404 additions and 317 deletions
+2 -11
View File
@@ -36,9 +36,9 @@ ThreadSession::thread_session() {
return m_thread_session;
}
// TODO: Remove '= 0'.
void
ThreadSession::init_thread() {
ThreadSession::init_thread_pre_start() {
m_manager->start();
}
// TODO: Make sure we trigger session save before main thread exits, that it adds all required
@@ -52,18 +52,9 @@ void
ThreadSession::call_events() {
// lt_log_print_locked(torrent::LOG_THREAD_NOTICE, "Got thread_disk tick.");
// TODO: Wait with shutdown until all session data is saved.
process_callbacks();
if ((m_flags & flag_do_shutdown)) {
if (!m_manager->is_empty()) {
// TODO: Figure out a better way to wait for session save to complete.
// TODO: Sanity check to avoid getting stuck not shutting down.
// TODO: Should we depend on next_timeout() instead of callbacks?
return;
}
if ((m_flags & flag_did_shutdown))
throw torrent::internal_error("Already trigged shutdown.");