Moved Thread header to torrent/system directory.

This commit is contained in:
Jari Sundell
2026-04-22 16:02:05 +02:00
committed by GitHub
parent a964b0a350
commit eb96876eb2
15 changed files with 29 additions and 29 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
#include <functional> #include <functional>
#include <torrent/utils/scheduler.h> #include <torrent/utils/scheduler.h>
#include <torrent/utils/thread.h> #include <torrent/system/thread.h>
#include "canvas.h" #include "canvas.h"
#include "globals.h" #include "globals.h"
+1 -1
View File
@@ -2,7 +2,7 @@
#include <ctime> #include <ctime>
#include <torrent/torrent.h> #include <torrent/torrent.h>
#include <torrent/utils/thread.h> #include <torrent/system/thread.h>
#include "canvas.h" #include "canvas.h"
#include "utils.h" #include "utils.h"
+4 -4
View File
@@ -22,8 +22,8 @@ class SessionManager;
namespace scgi_thread { namespace scgi_thread {
torrent::utils::Thread* thread(); torrent::system::Thread* thread();
std::thread::id thread_id(); std::thread::id thread_id();
void callback(void* target, std::function<void ()>&& fn); void callback(void* target, std::function<void ()>&& fn);
void cancel_callback(void* target); void cancel_callback(void* target);
@@ -38,8 +38,8 @@ void set_rpc_log(const std::string& filename);
namespace session_thread { namespace session_thread {
torrent::utils::Thread* thread(); torrent::system::Thread* thread();
std::thread::id thread_id(); std::thread::id thread_id();
void callback(void* target, std::function<void ()>&& fn); void callback(void* target, std::function<void ()>&& fn);
void cancel_callback(void* target); void cancel_callback(void* target);
+2 -2
View File
@@ -147,7 +147,7 @@ main(int argc, char** argv) {
// platforms that do not properly pass signals to the target // platforms that do not properly pass signals to the target
// threads. Use '--enable-interrupt-socket' when configuring // threads. Use '--enable-interrupt-socket' when configuring
// LibTorrent to enable this workaround. // LibTorrent to enable this workaround.
if (torrent::utils::Thread::should_handle_sigusr1()) if (torrent::system::Thread::should_handle_sigusr1())
SignalHandler::set_handler(SIGUSR1, []() {}); SignalHandler::set_handler(SIGUSR1, []() {});
torrent::log_add_group_output(torrent::LOG_NOTICE, "important"); 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: "); 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->core()->download_list()->session_save();
control->cleanup(); control->cleanup();
+1 -1
View File
@@ -7,7 +7,7 @@
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <torrent/utils/thread.h> #include <torrent/system/thread.h>
#include "exec_file.h" #include "exec_file.h"
#include "parse.h" #include "parse.h"
+4 -4
View File
@@ -14,7 +14,7 @@
#include <torrent/net/poll.h> #include <torrent/net/poll.h>
#include <torrent/runtime/socket_manager.h> #include <torrent/runtime/socket_manager.h>
#include <torrent/utils/log.h> #include <torrent/utils/log.h>
#include <torrent/utils/thread.h> #include <torrent/system/thread.h>
#include "control.h" #include "control.h"
#include "globals.h" #include "globals.h"
@@ -63,7 +63,7 @@ SCgiTask::close() {
return; return;
torrent::main_thread::thread()->cancel_callback_and_wait(this); 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::runtime::socket_manager()->close_event_or_throw(this, [this]() {
torrent::this_thread::poll()->remove_and_close(this); torrent::this_thread::poll()->remove_and_close(this);
@@ -301,7 +301,7 @@ SCgiTask::detect_content_type(const std::string& content_type) {
void void
SCgiTask::receive_call(const char* buffer, uint32_t length) { 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; RpcManager::RPCType rpc_type;
@@ -363,7 +363,7 @@ SCgiTask::receive_call(const char* buffer, uint32_t length) {
void void
SCgiTask::receive_write(const char* buffer, uint32_t length) { 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)) if (buffer == nullptr || length > (100 << 20))
throw torrent::internal_error("SCgiTask::receive_write(...) received bad input."); throw torrent::internal_error("SCgiTask::receive_write(...) received bad input.");
+2 -2
View File
@@ -127,8 +127,8 @@ ThreadScgi::next_timeout() {
namespace scgi_thread { namespace scgi_thread {
torrent::utils::Thread* thread() { return scgi::ThreadScgiInternal::thread_scgi(); } torrent::system::Thread* thread() { return scgi::ThreadScgiInternal::thread_scgi(); }
std::thread::id thread_id() { return scgi::ThreadScgiInternal::thread_scgi()->thread_id(); } std::thread::id thread_id() { return scgi::ThreadScgiInternal::thread_scgi()->thread_id(); }
void callback(void* target, std::function<void ()>&& fn) { scgi::ThreadScgiInternal::thread_scgi()->callback(target, std::move(fn)); } void callback(void* target, std::function<void ()>&& fn) { scgi::ThreadScgiInternal::thread_scgi()->callback(target, std::move(fn)); }
void cancel_callback(void* target) { scgi::ThreadScgiInternal::thread_scgi()->cancel_callback(target); } void cancel_callback(void* target) { scgi::ThreadScgiInternal::thread_scgi()->cancel_callback(target); }
+2 -2
View File
@@ -3,7 +3,7 @@
#include <atomic> #include <atomic>
#include <string> #include <string>
#include <torrent/utils/thread.h> #include <torrent/system/thread.h>
namespace rpc { namespace rpc {
class SCgi; class SCgi;
@@ -13,7 +13,7 @@ namespace scgi {
class ThreadScgiInternal; class ThreadScgiInternal;
class ThreadScgi : public torrent::utils::Thread { class ThreadScgi : public torrent::system::Thread {
public: public:
static void create_thread(); static void create_thread();
+1 -1
View File
@@ -21,7 +21,7 @@
namespace session { namespace session {
SessionManager::SessionManager(torrent::utils::Thread* thread) SessionManager::SessionManager(torrent::system::Thread* thread)
: m_thread(thread), : m_thread(thread),
m_lockfile(std::make_unique<utils::Lockfile>()) { m_lockfile(std::make_unique<utils::Lockfile>()) {
} }
+2 -2
View File
@@ -44,7 +44,7 @@ public:
constexpr static int max_concurrent_processing = 16; constexpr static int max_concurrent_processing = 16;
constexpr static int max_cleanup_processing = 64; constexpr static int max_cleanup_processing = 64;
SessionManager(torrent::utils::Thread* thread); SessionManager(torrent::system::Thread* thread);
~SessionManager(); ~SessionManager();
bool is_used() const; bool is_used() const;
@@ -89,7 +89,7 @@ private:
bool replace_save_request_unsafe(SaveRequest& download); bool replace_save_request_unsafe(SaveRequest& download);
bool remove_completely_unsafe(core::Download* download, std::unique_lock<std::mutex>& lock); bool remove_completely_unsafe(core::Download* download, std::unique_lock<std::mutex>& lock);
torrent::utils::Thread* m_thread; torrent::system::Thread* m_thread;
bool m_freeze_info{}; bool m_freeze_info{};
std::string m_path; std::string m_path;
+2 -2
View File
@@ -74,8 +74,8 @@ ThreadSession::next_timeout() {
namespace session_thread { namespace session_thread {
torrent::utils::Thread* thread() { return session::ThreadSessionInternal::thread_session(); } torrent::system::Thread* thread() { return session::ThreadSessionInternal::thread_session(); }
std::thread::id thread_id() { return session::ThreadSessionInternal::thread_session()->thread_id(); } std::thread::id thread_id() { return session::ThreadSessionInternal::thread_session()->thread_id(); }
void callback(void* target, std::function<void ()>&& fn) { session::ThreadSessionInternal::thread_session()->callback(target, std::move(fn)); } void callback(void* target, std::function<void ()>&& fn) { session::ThreadSessionInternal::thread_session()->callback(target, std::move(fn)); }
void cancel_callback(void* target) { session::ThreadSessionInternal::thread_session()->cancel_callback(target); } void cancel_callback(void* target) { session::ThreadSessionInternal::thread_session()->cancel_callback(target); }
+2 -2
View File
@@ -1,14 +1,14 @@
#ifndef RTORRENT_SESSION_THREAD_SESSION_H #ifndef RTORRENT_SESSION_THREAD_SESSION_H
#define RTORRENT_SESSION_THREAD_SESSION_H #define RTORRENT_SESSION_THREAD_SESSION_H
#include <torrent/utils/thread.h> #include <torrent/system/thread.h>
namespace session { namespace session {
class SessionManager; class SessionManager;
class ThreadSessionInternal; class ThreadSessionInternal;
class ThreadSession : public torrent::utils::Thread { class ThreadSession : public torrent::system::Thread {
public: public:
static void create_thread(); static void create_thread();
+1 -1
View File
@@ -2,7 +2,7 @@
#include <torrent/exceptions.h> #include <torrent/exceptions.h>
#include <torrent/torrent.h> #include <torrent/torrent.h>
#include <torrent/utils/thread.h> #include <torrent/system/thread.h>
#include "display/frame.h" #include "display/frame.h"
#include "display/manager.h" #include "display/manager.h"
+2 -2
View File
@@ -6,9 +6,9 @@
#include "test/helpers/test_fixture.h" #include "test/helpers/test_fixture.h"
#include "test/helpers/test_thread.h" #include "test/helpers/test_thread.h"
#include "torrent/common.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: public:
static std::unique_ptr<TestMainThread> create(); static std::unique_ptr<TestMainThread> create();
static std::unique_ptr<TestMainThread> create_with_mock(); static std::unique_ptr<TestMainThread> create_with_mock();
+2 -2
View File
@@ -6,9 +6,9 @@
#include "test/helpers/test_utils.h" #include "test/helpers/test_utils.h"
#include "torrent/common.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: public:
enum test_state { enum test_state {
TEST_NONE, TEST_NONE,