mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-12 21:22:31 +00:00
Various scheduler and therad cleanups.
This commit is contained in:
+10
-18
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user