system/FileDescriptor: new wrapper class for a file descriptor

This commit is contained in:
Max Kellermann
2015-03-03 17:03:21 +01:00
parent 818d729d8b
commit 40a587bbaf
14 changed files with 443 additions and 124 deletions

View File

@@ -21,6 +21,7 @@
#define MPD_EVENT_FD_HXX
#include "check.h"
#include "FileDescriptor.hxx"
/**
* A class that wraps eventfd().
@@ -28,17 +29,19 @@
* Errors in the constructor are fatal.
*/
class EventFD {
int fd;
FileDescriptor fd;
public:
EventFD();
~EventFD();
~EventFD() {
fd.Close();
}
EventFD(const EventFD &other) = delete;
EventFD &operator=(const EventFD &other) = delete;
int Get() const {
return fd;
return fd.Get();
}
/**