event/SocketMonitor: add method Open()

Allow creating a closed SocketMonitor instance.
This commit is contained in:
Max Kellermann
2013-01-15 22:48:38 +01:00
parent 0c6072c4e4
commit a0ebd444ad
2 changed files with 27 additions and 9 deletions
+5
View File
@@ -54,6 +54,9 @@ public:
static constexpr unsigned ERROR = G_IO_ERR;
static constexpr unsigned HANGUP = G_IO_HUP;
SocketMonitor(EventLoop &_loop)
:fd(-1), loop(_loop), source(nullptr) {}
SocketMonitor(int _fd, EventLoop &_loop);
~SocketMonitor();
@@ -68,6 +71,8 @@ public:
return fd;
}
void Open(int _fd);
void Close();
void Schedule(unsigned flags) {