From eb96876eb2fb5944aca31fdbdde8401f07b4ad2e Mon Sep 17 00:00:00 2001 From: Jari Sundell Date: Wed, 22 Apr 2026 16:02:05 +0200 Subject: [PATCH] Moved Thread header to torrent/system directory. --- src/display/window.h | 2 +- src/display/window_log.cc | 2 +- src/globals.h | 8 ++++---- src/main.cc | 4 ++-- src/rpc/exec_file.cc | 2 +- src/rpc/scgi_task.cc | 8 ++++---- src/scgi/thread_scgi.cc | 4 ++-- src/scgi/thread_scgi.h | 4 ++-- src/session/session_manager.cc | 2 +- src/session/session_manager.h | 4 ++-- src/session/thread_session.cc | 4 ++-- src/session/thread_session.h | 4 ++-- src/ui/element_log_complete.cc | 2 +- test/helpers/test_main_thread.h | 4 ++-- test/helpers/test_thread.h | 4 ++-- 15 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/display/window.h b/src/display/window.h index a135cd5d..12e3dfbc 100644 --- a/src/display/window.h +++ b/src/display/window.h @@ -3,7 +3,7 @@ #include #include -#include +#include #include "canvas.h" #include "globals.h" diff --git a/src/display/window_log.cc b/src/display/window_log.cc index 620d75e1..65e9f11a 100644 --- a/src/display/window_log.cc +++ b/src/display/window_log.cc @@ -2,7 +2,7 @@ #include #include -#include +#include #include "canvas.h" #include "utils.h" diff --git a/src/globals.h b/src/globals.h index 1bd42a9f..dca7ae58 100644 --- a/src/globals.h +++ b/src/globals.h @@ -22,8 +22,8 @@ class SessionManager; namespace scgi_thread { -torrent::utils::Thread* thread(); -std::thread::id thread_id(); +torrent::system::Thread* thread(); +std::thread::id thread_id(); void callback(void* target, std::function&& fn); void cancel_callback(void* target); @@ -38,8 +38,8 @@ void set_rpc_log(const std::string& filename); namespace session_thread { -torrent::utils::Thread* thread(); -std::thread::id thread_id(); +torrent::system::Thread* thread(); +std::thread::id thread_id(); void callback(void* target, std::function&& fn); void cancel_callback(void* target); diff --git a/src/main.cc b/src/main.cc index c770936a..c797f193 100644 --- a/src/main.cc +++ b/src/main.cc @@ -147,7 +147,7 @@ main(int argc, char** argv) { // platforms that do not properly pass signals to the target // threads. Use '--enable-interrupt-socket' when configuring // LibTorrent to enable this workaround. - if (torrent::utils::Thread::should_handle_sigusr1()) + if (torrent::system::Thread::should_handle_sigusr1()) SignalHandler::set_handler(SIGUSR1, []() {}); torrent::log_add_group_output(torrent::LOG_NOTICE, "important"); @@ -438,7 +438,7 @@ main(int argc, char** argv) { rpc::commands.call_catch("event.system.startup_done", rpc::make_target(), "startup_done", "System startup_done event action failed: "); - torrent::utils::Thread::self()->event_loop(); + torrent::system::Thread::self()->event_loop(); control->core()->download_list()->session_save(); control->cleanup(); diff --git a/src/rpc/exec_file.cc b/src/rpc/exec_file.cc index 010e295e..1ff0b151 100644 --- a/src/rpc/exec_file.cc +++ b/src/rpc/exec_file.cc @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include "exec_file.h" #include "parse.h" diff --git a/src/rpc/scgi_task.cc b/src/rpc/scgi_task.cc index 75603cc6..57c34b5a 100644 --- a/src/rpc/scgi_task.cc +++ b/src/rpc/scgi_task.cc @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include "control.h" #include "globals.h" @@ -63,7 +63,7 @@ SCgiTask::close() { return; torrent::main_thread::thread()->cancel_callback_and_wait(this); - torrent::utils::Thread::self()->cancel_callback(this); + torrent::system::Thread::self()->cancel_callback(this); torrent::runtime::socket_manager()->close_event_or_throw(this, [this]() { torrent::this_thread::poll()->remove_and_close(this); @@ -301,7 +301,7 @@ SCgiTask::detect_content_type(const std::string& content_type) { void SCgiTask::receive_call(const char* buffer, uint32_t length) { - assert(torrent::utils::Thread::self() == scgi_thread::thread()); + assert(torrent::system::Thread::self() == scgi_thread::thread()); RpcManager::RPCType rpc_type; @@ -363,7 +363,7 @@ SCgiTask::receive_call(const char* buffer, uint32_t length) { void SCgiTask::receive_write(const char* buffer, uint32_t length) { - assert(torrent::utils::Thread::self() == torrent::main_thread::thread()); + assert(torrent::system::Thread::self() == torrent::main_thread::thread()); if (buffer == nullptr || length > (100 << 20)) throw torrent::internal_error("SCgiTask::receive_write(...) received bad input."); diff --git a/src/scgi/thread_scgi.cc b/src/scgi/thread_scgi.cc index e44ce473..ada7b7ad 100644 --- a/src/scgi/thread_scgi.cc +++ b/src/scgi/thread_scgi.cc @@ -127,8 +127,8 @@ ThreadScgi::next_timeout() { namespace scgi_thread { -torrent::utils::Thread* thread() { return scgi::ThreadScgiInternal::thread_scgi(); } -std::thread::id thread_id() { return scgi::ThreadScgiInternal::thread_scgi()->thread_id(); } +torrent::system::Thread* thread() { return scgi::ThreadScgiInternal::thread_scgi(); } +std::thread::id thread_id() { return scgi::ThreadScgiInternal::thread_scgi()->thread_id(); } void callback(void* target, std::function&& fn) { scgi::ThreadScgiInternal::thread_scgi()->callback(target, std::move(fn)); } void cancel_callback(void* target) { scgi::ThreadScgiInternal::thread_scgi()->cancel_callback(target); } diff --git a/src/scgi/thread_scgi.h b/src/scgi/thread_scgi.h index a7173fa2..824ffa98 100644 --- a/src/scgi/thread_scgi.h +++ b/src/scgi/thread_scgi.h @@ -3,7 +3,7 @@ #include #include -#include +#include namespace rpc { class SCgi; @@ -13,7 +13,7 @@ namespace scgi { class ThreadScgiInternal; -class ThreadScgi : public torrent::utils::Thread { +class ThreadScgi : public torrent::system::Thread { public: static void create_thread(); diff --git a/src/session/session_manager.cc b/src/session/session_manager.cc index 2eedd4aa..3d2468be 100644 --- a/src/session/session_manager.cc +++ b/src/session/session_manager.cc @@ -21,7 +21,7 @@ namespace session { -SessionManager::SessionManager(torrent::utils::Thread* thread) +SessionManager::SessionManager(torrent::system::Thread* thread) : m_thread(thread), m_lockfile(std::make_unique()) { } diff --git a/src/session/session_manager.h b/src/session/session_manager.h index 7aa53c04..4fa76843 100644 --- a/src/session/session_manager.h +++ b/src/session/session_manager.h @@ -44,7 +44,7 @@ public: constexpr static int max_concurrent_processing = 16; constexpr static int max_cleanup_processing = 64; - SessionManager(torrent::utils::Thread* thread); + SessionManager(torrent::system::Thread* thread); ~SessionManager(); bool is_used() const; @@ -89,7 +89,7 @@ private: bool replace_save_request_unsafe(SaveRequest& download); bool remove_completely_unsafe(core::Download* download, std::unique_lock& lock); - torrent::utils::Thread* m_thread; + torrent::system::Thread* m_thread; bool m_freeze_info{}; std::string m_path; diff --git a/src/session/thread_session.cc b/src/session/thread_session.cc index adc66194..bf698beb 100644 --- a/src/session/thread_session.cc +++ b/src/session/thread_session.cc @@ -74,8 +74,8 @@ ThreadSession::next_timeout() { namespace session_thread { -torrent::utils::Thread* thread() { return session::ThreadSessionInternal::thread_session(); } -std::thread::id thread_id() { return session::ThreadSessionInternal::thread_session()->thread_id(); } +torrent::system::Thread* thread() { return session::ThreadSessionInternal::thread_session(); } +std::thread::id thread_id() { return session::ThreadSessionInternal::thread_session()->thread_id(); } void callback(void* target, std::function&& fn) { session::ThreadSessionInternal::thread_session()->callback(target, std::move(fn)); } void cancel_callback(void* target) { session::ThreadSessionInternal::thread_session()->cancel_callback(target); } diff --git a/src/session/thread_session.h b/src/session/thread_session.h index 173d737c..49fb2c82 100644 --- a/src/session/thread_session.h +++ b/src/session/thread_session.h @@ -1,14 +1,14 @@ #ifndef RTORRENT_SESSION_THREAD_SESSION_H #define RTORRENT_SESSION_THREAD_SESSION_H -#include +#include namespace session { class SessionManager; class ThreadSessionInternal; -class ThreadSession : public torrent::utils::Thread { +class ThreadSession : public torrent::system::Thread { public: static void create_thread(); diff --git a/src/ui/element_log_complete.cc b/src/ui/element_log_complete.cc index 10d9d0ee..5e2ea351 100644 --- a/src/ui/element_log_complete.cc +++ b/src/ui/element_log_complete.cc @@ -2,7 +2,7 @@ #include #include -#include +#include #include "display/frame.h" #include "display/manager.h" diff --git a/test/helpers/test_main_thread.h b/test/helpers/test_main_thread.h index 03a294eb..fcfce80f 100644 --- a/test/helpers/test_main_thread.h +++ b/test/helpers/test_main_thread.h @@ -6,9 +6,9 @@ #include "test/helpers/test_fixture.h" #include "test/helpers/test_thread.h" #include "torrent/common.h" -#include "torrent/utils/thread.h" +#include "torrent/system/thread.h" -class TestMainThread : public torrent::utils::Thread { +class TestMainThread : public torrent::system::Thread { public: static std::unique_ptr create(); static std::unique_ptr create_with_mock(); diff --git a/test/helpers/test_thread.h b/test/helpers/test_thread.h index b3e19f17..b64d6aeb 100644 --- a/test/helpers/test_thread.h +++ b/test/helpers/test_thread.h @@ -6,9 +6,9 @@ #include "test/helpers/test_utils.h" #include "torrent/common.h" -#include "torrent/utils/thread.h" +#include "torrent/system/thread.h" -class test_thread : public torrent::utils::Thread { +class test_thread : public torrent::system::Thread { public: enum test_state { TEST_NONE,