Use separate thread for saving session data.

This commit is contained in:
Jari Sundell
2025-12-17 22:42:44 +01:00
committed by GitHub
parent 16ff32b88c
commit 8f644e65dd
21 changed files with 668 additions and 209 deletions
+43
View File
@@ -0,0 +1,43 @@
#ifndef RTORRENT_SESSION_THREAD_SESSION_H
#define RTORRENT_SESSION_THREAD_SESSION_H
#include <torrent/utils/thread.h>
namespace session {
class SessionManager;
class ThreadSessionInternal;
class ThreadSession : public torrent::utils::Thread {
public:
static void create_thread();
static void destroy_thread();
static ThreadSession* thread_session();
const char* name() const override { return "rtorrent-session"; }
void init_thread() override;
void cleanup_thread() override;
SessionManager* manager() const { return m_manager.get(); }
protected:
friend class ThreadSessionInternal;
ThreadSession() = default;
static auto internal_thread_session() { return m_thread_session; }
void call_events() override;
std::chrono::microseconds next_timeout() override;
private:
static ThreadSession* m_thread_session;
std::unique_ptr<SessionManager> m_manager;
};
} // namespace session
#endif // RTORRENT_SESSION_THREAD_SESSION_H