mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-11 04:32:30 +00:00
* Rewrote 'select' based polling in the client and finished the
'epoll' code. The client selects whichever is available on the current platform. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@510 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -36,10 +36,33 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "control.h"
|
||||
|
||||
namespace ui {
|
||||
|
||||
Control::Control() :
|
||||
m_shutdownReceived(false) {
|
||||
|
||||
m_inputStdin = new input::InputEvent(STDIN_FILENO);
|
||||
m_inputStdin->slot_pressed(sigc::mem_fun(m_input, &input::Manager::pressed));
|
||||
}
|
||||
|
||||
Control::~Control() {
|
||||
delete m_inputStdin;
|
||||
}
|
||||
|
||||
void
|
||||
Control::initialize() {
|
||||
m_inputStdin->insert(m_core.get_poll_manager()->get_torrent_poll());
|
||||
}
|
||||
|
||||
void
|
||||
Control::cleanup() {
|
||||
m_inputStdin->remove(m_core.get_poll_manager()->get_torrent_poll());
|
||||
}
|
||||
|
||||
// I think it should be safe to initiate the shutdown from anywhere,
|
||||
// but if it isn't, use a delay task.
|
||||
void
|
||||
|
||||
+8
-1
@@ -42,6 +42,7 @@
|
||||
#include "core/manager.h"
|
||||
#include "display/manager.h"
|
||||
#include "input/manager.h"
|
||||
#include "input/input_event.h"
|
||||
|
||||
#include "root.h"
|
||||
|
||||
@@ -49,7 +50,8 @@ namespace ui {
|
||||
|
||||
class Control {
|
||||
public:
|
||||
Control() : m_shutdownReceived(false) {}
|
||||
Control();
|
||||
~Control();
|
||||
|
||||
bool is_shutdown_completed() { return m_shutdownReceived && torrent::is_inactive(); }
|
||||
bool is_shutdown_received() { return m_shutdownReceived; }
|
||||
@@ -58,6 +60,10 @@ public:
|
||||
core::Manager& get_core() { return m_core; }
|
||||
display::Manager& get_display() { return m_display; }
|
||||
input::Manager& get_input() { return m_input; }
|
||||
input::InputEvent* get_input_stdin() { return m_inputStdin; }
|
||||
|
||||
void initialize();
|
||||
void cleanup();
|
||||
|
||||
void receive_shutdown();
|
||||
|
||||
@@ -71,6 +77,7 @@ private:
|
||||
core::Manager m_core;
|
||||
display::Manager m_display;
|
||||
input::Manager m_input;
|
||||
input::InputEvent* m_inputStdin;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user