Various scheduler and therad cleanups.

This commit is contained in:
Jari Sundell
2025-05-01 09:38:49 +02:00
committed by GitHub
parent 3d9c083032
commit 97415c656b
10 changed files with 55 additions and 247 deletions
+10 -18
View File
@@ -2,44 +2,36 @@
#define RTORRENT_THREAD_WORKER_H
#include <atomic>
#include "thread_base.h"
#include "rak/priority_queue_default.h"
#include <string>
#include <torrent/utils/thread.h>
namespace rpc {
class SCgi;
}
// Check if cacheline aligned with inheritance ends up taking two
// cachelines.
class ThreadWorker : public ThreadBase {
class ThreadWorker : public torrent::utils::Thread {
public:
ThreadWorker() = default;
~ThreadWorker();
const char* name() const { return "rtorrent scgi"; }
const char* name() const override { return "rtorrent scgi"; }
virtual void init_thread();
void init_thread() override;
rpc::SCgi* scgi() { return m_scgi; }
rpc::SCgi* scgi() { return m_scgi; }
bool set_scgi(rpc::SCgi* scgi);
void set_rpc_log(const std::string& filename);
static void start_scgi(ThreadBase* thread);
static void msg_change_rpc_log(ThreadBase* thread);
private:
void task_touch_log();
void change_rpc_log();
std::atomic<rpc::SCgi*> m_scgi{ nullptr };
void call_events() override;
std::chrono::microseconds next_timeout() override;
// The following types shall only be modified while holding the
// global lock.
std::string m_rpcLog;
std::atomic<rpc::SCgi*> m_scgi{nullptr};
std::string m_rpc_log_filename;
};
#endif