mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-05 17:52:29 +00:00
Moved Thread header to torrent/system directory.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <functional>
|
||||
#include <torrent/utils/scheduler.h>
|
||||
#include <torrent/utils/thread.h>
|
||||
#include <torrent/system/thread.h>
|
||||
|
||||
#include "canvas.h"
|
||||
#include "globals.h"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <ctime>
|
||||
#include <torrent/torrent.h>
|
||||
#include <torrent/utils/thread.h>
|
||||
#include <torrent/system/thread.h>
|
||||
|
||||
#include "canvas.h"
|
||||
#include "utils.h"
|
||||
|
||||
+4
-4
@@ -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<void ()>&& 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<void ()>&& fn);
|
||||
void cancel_callback(void* target);
|
||||
|
||||
+2
-2
@@ -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();
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <torrent/utils/thread.h>
|
||||
#include <torrent/system/thread.h>
|
||||
|
||||
#include "exec_file.h"
|
||||
#include "parse.h"
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <torrent/net/poll.h>
|
||||
#include <torrent/runtime/socket_manager.h>
|
||||
#include <torrent/utils/log.h>
|
||||
#include <torrent/utils/thread.h>
|
||||
#include <torrent/system/thread.h>
|
||||
|
||||
#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.");
|
||||
|
||||
@@ -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<void ()>&& fn) { scgi::ThreadScgiInternal::thread_scgi()->callback(target, std::move(fn)); }
|
||||
void cancel_callback(void* target) { scgi::ThreadScgiInternal::thread_scgi()->cancel_callback(target); }
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <atomic>
|
||||
#include <string>
|
||||
#include <torrent/utils/thread.h>
|
||||
#include <torrent/system/thread.h>
|
||||
|
||||
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();
|
||||
|
||||
@@ -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<utils::Lockfile>()) {
|
||||
}
|
||||
|
||||
@@ -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<std::mutex>& lock);
|
||||
|
||||
torrent::utils::Thread* m_thread;
|
||||
torrent::system::Thread* m_thread;
|
||||
|
||||
bool m_freeze_info{};
|
||||
std::string m_path;
|
||||
|
||||
@@ -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<void ()>&& fn) { session::ThreadSessionInternal::thread_session()->callback(target, std::move(fn)); }
|
||||
void cancel_callback(void* target) { session::ThreadSessionInternal::thread_session()->cancel_callback(target); }
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#ifndef RTORRENT_SESSION_THREAD_SESSION_H
|
||||
#define RTORRENT_SESSION_THREAD_SESSION_H
|
||||
|
||||
#include <torrent/utils/thread.h>
|
||||
#include <torrent/system/thread.h>
|
||||
|
||||
namespace session {
|
||||
|
||||
class SessionManager;
|
||||
class ThreadSessionInternal;
|
||||
|
||||
class ThreadSession : public torrent::utils::Thread {
|
||||
class ThreadSession : public torrent::system::Thread {
|
||||
public:
|
||||
|
||||
static void create_thread();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <torrent/exceptions.h>
|
||||
#include <torrent/torrent.h>
|
||||
#include <torrent/utils/thread.h>
|
||||
#include <torrent/system/thread.h>
|
||||
|
||||
#include "display/frame.h"
|
||||
#include "display/manager.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<TestMainThread> create();
|
||||
static std::unique_ptr<TestMainThread> create_with_mock();
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user