summaryrefslogtreecommitdiff
path: root/src/event/SocketMonitor.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-08-10 18:25:22 +0200
committerMax Kellermann <max@musicpd.org>2017-08-10 19:19:58 +0200
commit492b20a89d98739d0020f0c8c449ce8778405fc4 (patch)
treebdd11a6b1c5a1eb63e256931a2b20d076ca47760 /src/event/SocketMonitor.hxx
parentfcfc8bacc008ce04aa75e50cb33825648bba917f (diff)
event/SocketMonitor: use class SocketDescriptor
Diffstat (limited to 'src/event/SocketMonitor.hxx')
-rw-r--r--src/event/SocketMonitor.hxx13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/event/SocketMonitor.hxx b/src/event/SocketMonitor.hxx
index 989da2cfe..941bf19c0 100644
--- a/src/event/SocketMonitor.hxx
+++ b/src/event/SocketMonitor.hxx
@@ -22,6 +22,7 @@
#include "check.h"
#include "PollGroup.hxx"
+#include "net/SocketDescriptor.hxx"
#include <type_traits>
@@ -52,7 +53,7 @@ class EventLoop;
* as thread-safe.
*/
class SocketMonitor {
- int fd;
+ SocketDescriptor fd;
EventLoop &loop;
/**
@@ -71,7 +72,7 @@ public:
SocketMonitor(EventLoop &_loop)
:fd(-1), loop(_loop), scheduled_flags(0) {}
- SocketMonitor(int _fd, EventLoop &_loop)
+ SocketMonitor(SocketDescriptor _fd, EventLoop &_loop)
:fd(_fd), loop(_loop), scheduled_flags(0) {}
~SocketMonitor();
@@ -81,22 +82,22 @@ public:
}
bool IsDefined() const {
- return fd >= 0;
+ return fd.IsDefined();
}
- int Get() const {
+ SocketDescriptor Get() const {
assert(IsDefined());
return fd;
}
- void Open(int _fd);
+ void Open(SocketDescriptor _fd);
/**
* "Steal" the socket descriptor. This abandons the socket
* and returns it.
*/
- int Steal();
+ SocketDescriptor Steal();
/**
* Somebody has closed the socket. Unregister this object.